diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fd6b075..536ea21f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ -1.7.1 +1.7.3 +* [FIX] #200: Unable to set to the ValidFrom of the latest version + +1.7.2 +* [FIX] #195: Content search config in SC9 uses incorrect class name + +1.7.1 * [FIX] #191: Added references to Sitecore pipelines necessary for testing updates to layout fields with Sitecore 9 (thanks to [@AndyButland](https://github.com/AndyButland)) 1.7.0 diff --git a/src/AssemblyVersionInfo.cs b/src/AssemblyVersionInfo.cs index 7bd5630b..f75a5434 100644 --- a/src/AssemblyVersionInfo.cs +++ b/src/AssemblyVersionInfo.cs @@ -1,5 +1,5 @@ using System.Reflection; -[assembly: AssemblyVersion("1.7.1.0")] -[assembly: AssemblyFileVersion("1.7.1.0")] -[assembly: AssemblyInformationalVersion("1.7.1")] \ No newline at end of file +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] +[assembly: AssemblyInformationalVersion("1.7.3")] \ No newline at end of file diff --git a/src/Sitecore.FakeDb/Data/DataProviders/FakeDataProvider.cs b/src/Sitecore.FakeDb/Data/DataProviders/FakeDataProvider.cs index 1ea514d2..11582d66 100644 --- a/src/Sitecore.FakeDb/Data/DataProviders/FakeDataProvider.cs +++ b/src/Sitecore.FakeDb/Data/DataProviders/FakeDataProvider.cs @@ -362,10 +362,9 @@ public override bool SaveItem(ItemDefinition itemDefinition, ItemChanges changes } else { - item.Fields.Add(new DbField(change.FieldID) - { - Value = change.Value - }); + var newField = new DbField(change.FieldID); + newField.SetValue(change.Language.Name, change.Version.Number, change.Value); + item.Fields.Add(newField); } } } diff --git a/test/Sitecore.FakeDb.Tests/DbTest.cs b/test/Sitecore.FakeDb.Tests/DbTest.cs index fa55abc6..1cc1942b 100644 --- a/test/Sitecore.FakeDb.Tests/DbTest.cs +++ b/test/Sitecore.FakeDb.Tests/DbTest.cs @@ -20,8 +20,8 @@ using Sitecore.Security.Accounts; using Sitecore.SecurityModel; using Xunit; - using Version = Sitecore.Data.Version; - + using Version = Sitecore.Data.Version; + [Trait("Category", "RequireLicense")] public class DbTest { @@ -1813,22 +1813,55 @@ public void ShouldCreateDbWithSpecificLanguages(string database) [Fact] public void ShouldNotFailIfLanguageSwitcherDisposedElsewhere() - { - using (new Db() - .WithLanguages(Language.Parse("da"))) - { - Switcher.Exit(); - } - } - - [Fact] - public void ShouldAddWildcard() - { - using (var db = new Db()) - { - var item = db.GetItem("/sitecore/content/"); - item.Add("*", new TemplateID(TemplateIDs.Folder)); - } + { + using (new Db() + .WithLanguages(Language.Parse("da"))) + { + Switcher.Exit(); + } + } + + [Fact] + public void ShouldAddWildcard() + { + using (var db = new Db()) + { + var item = db.GetItem("/sitecore/content/"); + item.Add("*", new TemplateID(TemplateIDs.Folder)); + } + } + + [Fact] + public void EditContextSavesFieldValueOfProperVersion() + { + var expectedV1 = DateTime.MinValue; + var expectedV2 = new DateTime(2018, 10, 25, 15, 14, 00, DateTimeKind.Utc); + using (var db = new Db + { + new DbItem("Home") + { + new DbField("Text") + { + {"en", 1, ""}, + {"en", 2, ""} + } + } + }) + { + var homeV2 = db.GetItem("/sitecore/content/Home", "en", 2); + using (new EditContext(homeV2)) + { + homeV2.Publishing.ValidFrom = expectedV2; + } + var homeV1 = db.GetItem("/sitecore/content/Home", "en", 1); + homeV2 = db.GetItem("/sitecore/content/Home", "en", 2); + + var actualV1 = homeV1.Publishing.ValidFrom; + var actualV2 = homeV2.Publishing.ValidFrom; + + Assert.Equal(expectedV1, actualV1); + Assert.Equal(expectedV2, actualV2); + } } } } \ No newline at end of file