public void NullNoneMatchingConstraints() { var s = Moksy.Common.SimulationFactory.When.I.Post().ToImdb("/Pet").With.Constraint(new LengthEquals("TheProperty", 4)); SimulationManager mgr = new SimulationManager(); mgr.Add(s.Simulation); var result = mgr.FindMatchingConstraints(s.Simulation, null, null, null); Assert.AreEqual(0, result.Count()); }
public void MatchesJsonOneViolation() { var v = new LengthEquals("TheProperty", 4); var s = Moksy.Common.SimulationFactory.When.I.Post().ToImdb("/Pet").With.Constraint(v); SimulationManager mgr = new SimulationManager(); mgr.Add(s.Simulation); var matches = mgr.FindMatchingConstraints(s.Simulation, new List<ConstraintBase>() { v }, @"{ ""TheProperty"":""ABCD"" }", null); Assert.AreEqual(1, matches.Count()); }