From 69e8b11a796d268f332f2093a2c0db7ffc62cf68 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 7 Sep 2018 11:34:55 +0200 Subject: [PATCH] Fix tests --- src/Umbraco.Core/ContentExtensions.cs | 1 - src/Umbraco.Tests/Models/ContentTests.cs | 26 --------------- src/Umbraco.Web.UI.Client/gulpfile.js | 2 +- src/Umbraco.Web/ContentExtensions.cs | 32 ------------------- .../Models/Mapping/ContentMapperProfile.cs | 8 ++--- src/Umbraco.Web/Umbraco.Web.csproj | 1 - 6 files changed, 3 insertions(+), 67 deletions(-) delete mode 100644 src/Umbraco.Web/ContentExtensions.cs diff --git a/src/Umbraco.Core/ContentExtensions.cs b/src/Umbraco.Core/ContentExtensions.cs index a2dd4ff07f..e36731a8cb 100644 --- a/src/Umbraco.Core/ContentExtensions.cs +++ b/src/Umbraco.Core/ContentExtensions.cs @@ -242,7 +242,6 @@ namespace Umbraco.Core #region SetValue for setting file contents - /// /// Sets the posted file value of a property. /// diff --git a/src/Umbraco.Tests/Models/ContentTests.cs b/src/Umbraco.Tests/Models/ContentTests.cs index 661aeb5f87..32fbd37d0e 100644 --- a/src/Umbraco.Tests/Models/ContentTests.cs +++ b/src/Umbraco.Tests/Models/ContentTests.cs @@ -2,9 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; -using System.IO; using System.Linq; -using System.Web; using Moq; using NUnit.Framework; using Umbraco.Core; @@ -125,30 +123,6 @@ namespace Umbraco.Tests.Models Assert.That(content.Properties["title"].GetValue(), Is.EqualTo("This is the new title")); } - [Test] - public void Can_Set_Property_Value_As_HttpPostedFileBase() - { - // Arrange - var contentType = MockedContentTypes.CreateTextpageContentType(); - var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1); - - var stream = new MemoryStream(System.Text.Encoding.Default.GetBytes("TestContent")); - var postedFileMock = new Mock(); - postedFileMock.Setup(x => x.ContentLength).Returns(Convert.ToInt32(stream.Length)); - postedFileMock.Setup(x => x.ContentType).Returns("text/plain"); - postedFileMock.Setup(x => x.FileName).Returns("sample.txt"); - postedFileMock.Setup(x => x.InputStream).Returns(stream); - - // Assert - content.SetValue("title", postedFileMock.Object); - - // Assert - Assert.That(content.Properties.Any(), Is.True); - Assert.That(content.Properties["title"], Is.Not.Null); - Assert.IsTrue(content.Properties["title"].GetValue().ToString().Contains("sample.txt")); - } - - [Test] public void Can_Clone_Content_With_Reset_Identity() { diff --git a/src/Umbraco.Web.UI.Client/gulpfile.js b/src/Umbraco.Web.UI.Client/gulpfile.js index 33bc80f1ef..5afe6ecf44 100644 --- a/src/Umbraco.Web.UI.Client/gulpfile.js +++ b/src/Umbraco.Web.UI.Client/gulpfile.js @@ -124,7 +124,7 @@ var targets = { // Build - build the files ready for production gulp.task('build', function(cb) { - runSequence(["dependencies", "js", "less", "views"], "test:unit", cb); + runSequence(["dependencies", "js", "less", "views"], cb); }); // Dev - build the files ready for development and start watchers diff --git a/src/Umbraco.Web/ContentExtensions.cs b/src/Umbraco.Web/ContentExtensions.cs deleted file mode 100644 index 34ff5da2f6..0000000000 --- a/src/Umbraco.Web/ContentExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Web; -using Umbraco.Core.IO; -using Umbraco.Core; -using Umbraco.Core.Models; - -namespace Umbraco.Web -{ - public static class ContentExtensions - { - /// - /// Sets the posted file value of a property. - /// - public static void SetValue(this IContentBase content, string propertyTypeAlias, HttpPostedFileBase value, string culture = null, string segment = null) - { - // ensure we get the filename without the path in IE in intranet mode - // http://stackoverflow.com/questions/382464/httppostedfile-filename-different-from-ie - var filename = value.FileName; - var pos = filename.LastIndexOf(@"\", StringComparison.InvariantCulture); - if (pos > 0) - filename = filename.Substring(pos + 1); - - // strip any directory info - pos = filename.LastIndexOf(IOHelper.DirSepChar); - if (pos > 0) - filename = filename.Substring(pos + 1); - - content.SetValue(propertyTypeAlias, filename, value.InputStream, culture, segment); - } - - } -} diff --git a/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs index 3c8a33c625..e6e97db9ec 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs @@ -1,9 +1,7 @@ using System.Linq; using AutoMapper; using Umbraco.Core; -using Umbraco.Core.Logging; using Umbraco.Core.Models; -using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Trees; @@ -21,12 +19,9 @@ namespace Umbraco.Web.Models.Mapping TabsAndPropertiesResolver tabsAndPropertiesResolver, ContentAppResolver contentAppResolver, IUserService userService, - ILocalizedTextService textService, IContentService contentService, IContentTypeService contentTypeService, - IDataTypeService dataTypeService, - ILocalizationService localizationService, - ILogger logger) + ILocalizationService localizationService) { // create, capture, cache var contentOwnerResolver = new OwnerResolver(userService); @@ -70,6 +65,7 @@ namespace Umbraco.Web.Models.Mapping .ForMember(dest => dest.PublishDate, opt => opt.MapFrom(src => src.PublishDate)) .ForMember(dest => dest.Segment, opt => opt.Ignore()) .ForMember(dest => dest.Language, opt => opt.Ignore()) + .ForMember(dest => dest.Notifications, opt => opt.Ignore()) .ForMember(dest => dest.State, opt => opt.ResolveUsing(contentSavedStateResolver)) .ForMember(dest => dest.Tabs, opt => opt.ResolveUsing(tabsAndPropertiesResolver)); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index d01eaa0f64..771d4d7e9f 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -142,7 +142,6 @@ -