public void CanAddIfEndpointDoesNotExist() { Moksy.Storage.SimulationManager manager = new Storage.SimulationManager(); Simulation s = new Simulation(); s.Condition.SimulationConditionContent.Pattern = "/Pet"; Assert.IsTrue(manager.CanAdd(s, "/Pet", "Kind", "Dog", null)); }
// Obsoleted: Imdb must now be Json. Always. // [TestMethod] public void CanAddIfEndpointContainsOneEntryThatIsNotJson() { Moksy.Storage.SimulationManager manager = new Storage.SimulationManager(); var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation; manager.AddToImdb(s, "/Pet", "/Pet", "NotValidJson", null); Assert.IsTrue(manager.CanAdd(s, "/Pet", "Something", "Else", null)); }
public void CanAddIfEndpointContainsOneEntryThatIsJsonAndDOesNotMatchValue() { Moksy.Storage.SimulationManager manager = new Storage.SimulationManager(); var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation; manager.AddToImdb(s, "/Pet", "/Pet", @"{ ""Kind"" : ""Cat"" }", null); Assert.IsTrue(manager.CanAdd(s, "/Pet", "Kind", "Dog", null)); }
public void CanAddIfEndpointContainsOneEntryThatIsJsonButEmpty() { Moksy.Storage.SimulationManager manager = new Storage.SimulationManager(); var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation; manager.AddToImdb(s, "/Pet", "/Pet", "{ }", null); Assert.IsTrue(manager.CanAdd(s, "/Pet", "Kind", "Dog", null)); }
// Obsoleted: Imdb must now be Json. Always. // [TestMethod] public void CanNotAddButAfterEmptyMismatchAndValueMismatch() { Moksy.Storage.SimulationManager manager = new Storage.SimulationManager(); var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation; manager.AddToImdb(s, "/Pet", "/Pet", @"{ }", null); manager.AddToImdb(s, "/Pet", "/Pet", @"NotJson", null); manager.AddToImdb(s, "/Pet", "/Pet", @"{ ""Kind"" : ""Cat"" }", null); manager.AddToImdb(s, "/Pet", "/Pet", @"{ ""Kind"" : ""Dog"" }", null); Assert.IsFalse(manager.CanAdd(s, "/Pet", "Kind", "Dog", null)); }