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)); }
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."); }
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)); }
public void ChangeTemplateThrowsIfTemplateChangeListIsNull(FakeDataProvider sut, ItemDefinition def) { Action action = () => sut.ChangeTemplate(def, null, null); action.ShouldThrow <ArgumentNullException>(); }