public void ChangeTemplateThrowsIfNoDbItemFound([Greedy] FakeDataProvider sut, ItemDefinition def, TemplateChangeList changes)
        {
            Action action = () => sut.ChangeTemplate(def, changes, null);

            action.ShouldThrow <InvalidOperationException>()
            .WithMessage("Unable to change item template. The item '{0}' is not found.".FormatWith(def.ID));
        }
Ejemplo n.º 2
0
        public void ChangeTemplateThrowsIfNoTargetTemplateFound([Greedy] FakeDataProvider sut, ItemDefinition def, TemplateChangeList changes, DbItem item)
        {
            sut.DataStorage.GetFakeItem(def.ID).Returns(item);
            Action action = () => sut.ChangeTemplate(def, changes, null);

            action.ShouldThrow <InvalidOperationException>()
            .WithMessage("Unable to change item template. The target template is not found.");
        }
Ejemplo n.º 3
0
        public void ChangeTemplateThrowsIfNoDbItemFound(
            [Greedy] FakeDataProvider sut,
            ItemDefinition def)
        {
            var doc      = new XmlDocument();
            var template = doc.AppendChild(doc.CreateElement("template"));

            XmlUtil.AddAttribute("name", "template", template);
            var changes = new TemplateChangeList(
                Template.Parse(template, new TemplateCollection()),
                Template.Parse(template, new TemplateCollection()));

            Action action = () => sut.ChangeTemplate(def, changes, null);

            action.ShouldThrow <InvalidOperationException>()
            .WithMessage("Unable to change item template. The item '{0}' is not found.".FormatWith(def.ID));
        }
Ejemplo n.º 4
0
        public void ChangeTemplateThrowsIfTemplateChangeListIsNull(FakeDataProvider sut, ItemDefinition def)
        {
            Action action = () => sut.ChangeTemplate(def, null, null);

            action.ShouldThrow <ArgumentNullException>();
        }