예제 #1
0
        public void Save_ItemDisplayNameChanged_SavesName()
        {
            //Assign
            string expected = "new name";
            var    context  = Context.Create(DependencyResolver.CreateStandardResolver());

            context.Load(new UmbracoAttributeConfigurationLoader("Glass.Mapper.Umb.Integration"));
            var currentItem = _contentService.GetById(new Guid("{24814F74-CE52-4975-B9F3-15ABCBB132D6}"));
            var service     = new UmbracoService(_contentService, context);
            var cls         = new StubSaving();

            cls.Id = currentItem.Key;

            //setup item
            currentItem.Name = "old name";
            _contentService.Save(currentItem);

            //Act
            cls.Name = expected;
            service.Save(cls);

            //Assert
            var newItem = _contentService.GetById(new Guid("{24814F74-CE52-4975-B9F3-15ABCBB132D6}"));

            Assert.AreEqual(expected, newItem.Name);
        }
        public void Save_ItemDisplayNameChanged_SavesName()
        {
            //Assign
            string expected = "new name";
            var context = Context.Create(DependencyResolver.CreateStandardResolver());
            context.Load(new UmbracoAttributeConfigurationLoader("Glass.Mapper.Umb.Integration"));
            var currentItem = _contentService.GetById(new Guid("{24814F74-CE52-4975-B9F3-15ABCBB132D6}"));
            var service = new UmbracoService(_contentService, context);
            var cls = new StubSaving();
            cls.Id = currentItem.Key;

            //setup item
            currentItem.Name = "old name";
            _contentService.Save(currentItem);

            //Act
            cls.Name = expected;
            service.Save(cls);

            //Assert
            var newItem = _contentService.GetById(new Guid("{24814F74-CE52-4975-B9F3-15ABCBB132D6}"));

            Assert.AreEqual(expected, newItem.Name);
        }