// 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 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)); }
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)); }
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]); }
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()); }
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]); }
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)); }
// 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)); }