Exemple #1
0
        public void Variant_Published_Culture_Names_Track_Dirty_Changes()
        {
            IContentType contentType = new ContentTypeBuilder()
                                       .WithAlias("contentType")
                                       .WithContentVariation(ContentVariation.Culture)
                                       .Build();
            Content content = new ContentBuilder()
                              .WithId(1)
                              .WithVersionId(1)
                              .WithName("content")
                              .WithContentType(contentType)
                              .Build();

            const string langFr = "fr-FR";

            content.ChangeContentType(contentType);

            Assert.IsFalse(content.IsPropertyDirty("PublishCultureInfos")); // hasn't been changed

            Thread.Sleep(500);                                              // The "Date" wont be dirty if the test runs too fast since it will be the same date
            content.SetCultureName("name-fr", langFr);
            content.PublishCulture(CultureImpact.Explicit(langFr, false));  // we've set the name, now we're publishing it
            Assert.IsTrue(content.IsPropertyDirty("PublishCultureInfos"));  // now it will be changed since the collection has changed
            ContentCultureInfos frCultureName = content.PublishCultureInfos[langFr];

            Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));

            content.ResetDirtyProperties();

            Assert.IsFalse(content.IsPropertyDirty("PublishCultureInfos"));    // it's been reset
            Assert.IsTrue(content.WasPropertyDirty("PublishCultureInfos"));

            Thread.Sleep(500);                                             // The "Date" wont be dirty if the test runs too fast since it will be the same date
            content.SetCultureName("name-fr", langFr);
            content.PublishCulture(CultureImpact.Explicit(langFr, false)); // we've set the name, now we're publishing it
            Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));
            Assert.IsTrue(content.IsPropertyDirty("PublishCultureInfos")); // it's true now since we've updated a name
        }
Exemple #2
0
        public void Variant_Culture_Names_Track_Dirty_Changes()
        {
            IContentType contentType = new ContentTypeBuilder()
                                       .WithAlias("contentType")
                                       .WithContentVariation(ContentVariation.Culture)
                                       .Build();

            Mock.Get(_contentTypeService).As <IContentTypeBaseService>().Setup(x => x.Get(It.IsAny <int>())).Returns(contentType);

            Content content = new ContentBuilder()
                              .WithId(1)
                              .WithVersionId(1)
                              .WithName("content")
                              .WithContentType(contentType)
                              .Build();

            const string langFr = "fr-FR";

            Assert.IsFalse(content.IsPropertyDirty("CultureInfos"));    // hasn't been changed

            Thread.Sleep(500);                                          // The "Date" wont be dirty if the test runs too fast since it will be the same date
            content.SetCultureName("name-fr", langFr);
            Assert.IsTrue(content.IsPropertyDirty("CultureInfos"));     // now it will be changed since the collection has changed
            ContentCultureInfos frCultureName = content.CultureInfos[langFr];

            Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));

            content.ResetDirtyProperties();

            Assert.IsFalse(content.IsPropertyDirty("CultureInfos"));    // it's been reset
            Assert.IsTrue(content.WasPropertyDirty("CultureInfos"));

            Thread.Sleep(500);                                          // The "Date" wont be dirty if the test runs too fast since it will be the same date
            content.SetCultureName("name-fr", langFr);
            Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));
            Assert.IsTrue(content.IsPropertyDirty("CultureInfos"));     // it's true now since we've updated a name
        }