Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
 // 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));
 }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
 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));
 }
Ejemplo n.º 5
0
 // 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));
 }