public void Do_not_try_to_execute_the_action_when_requested_system_object_if_it_cannot_be_created() { var memento = new MemoryInstanceMemento(); var builder = new GraphBuilder(new Registry[0]); builder.WithSystemObject<MementoSource>(memento, "I am going to break here", delegate { Assert.Fail("Wasn't supposed to be called"); }); }
public void Create_system_object_successfully_and_call_the_requested_action() { var memento = new MemoryInstanceMemento("XmlFile", "anything"); memento.SetProperty("FilePath", "something"); memento.SetProperty("XPath", "nodeName"); memento.SetProperty("NodeName", "something"); bool iWasCalled = false; var builder = new GraphBuilder(new Registry[0]); builder.WithSystemObject<MementoSource>(memento, "some xml", policy => { Assert.IsInstanceOfType(typeof (XmlFileMementoSource), policy); iWasCalled = true; }); Assert.IsTrue(iWasCalled); }
public void Log_an_error_for_a_requested_system_object_if_it_cannot_be_created() { var memento = new MemoryInstanceMemento(); var builder = new GraphBuilder(new Registry[0]); builder.WithSystemObject<MementoSource>(memento, "I am going to break here", delegate { }); builder.PluginGraph.Log.AssertHasError(130); }