コード例 #1
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));
 }
コード例 #2
0
 public void CanAddObjectIfPropertyNotExists()
 {
     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.CanAddObject(s, "/Pet", "TheProperty", @"{ ""TheProperty"" : ""TheValue"" }", null));
 }
コード例 #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));
 }
コード例 #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));
 }
コード例 #5
0
 public void GetTwoKeysForObject()
 {
     Moksy.Storage.SimulationManager manager = new Storage.SimulationManager();
     var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation;
     s.Condition.SimulationConditionContent.IndexProperty = "Kind";
     manager.AddToImdb(s, "/Pet", "/Pet", @"{ ""Kind"" : ""Dog"" }", null);
     manager.AddToImdb(s, "/Pet", "/Pet", @"{ ""Kind"" : ""Cat"" }", null);
     var result = manager.GetKeysFor("/Pet", "/Pet", "Kind", null);
     Assert.AreEqual(2, result.Count());
     Assert.AreEqual("Dog", result.ToArray()[0]);
     Assert.AreEqual("Cat", result.ToArray()[1]);
 }
コード例 #6
0
 public void GetsNoKeysForNullObject()
 {
     Moksy.Storage.SimulationManager manager = new Storage.SimulationManager();
     var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation;
     manager.AddToImdb(s, "/Pet", "/Pet", "{ }", null);
     var result = manager.GetKeysFor("/Pet", "/Pet", "Kind", null);
     Assert.AreEqual(0, result.Count());
 }
コード例 #7
0
 public void GetOneKeysForObject()
 {
     Moksy.Storage.SimulationManager manager = new Storage.SimulationManager();
     var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation;
     manager.AddToImdb(s, "/Pet", "/Pet", @"{ ""Kind"" : ""Dog"" }", null);
     var result = manager.GetKeysFor("/Pet", "/Pet", "Kind", null);
     Assert.AreEqual(1, result.Count());
     Assert.AreEqual("Dog", result.ToArray()[0]);
 }
コード例 #8
0
 public void CanNotAddObjectIfPropertyIsImplicitlyAlreadyNull()
 {
     Moksy.Storage.SimulationManager manager = new Storage.SimulationManager();
     var s = SimulationFactory.When.I.Post().ToImdb("/Pet").Simulation;
     manager.AddToImdb(s, "/Pet", "/Pet", @"{ }", null);
     Assert.IsFalse(manager.CanAddObject(s, "/Pet", "TheProperty", "{ }", null));
 }
コード例 #9
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));
 }