public void IsNullNull() { IsNull c = new IsNull("TheProperty"); var j = GetJ(@"{""TheProperty"":null}"); Assert.IsTrue(c.Evaluate(j)); Assert.AreEqual(@"{""Name"":""IsNull"",""PropertyName"":""TheProperty"",""PropertyValue"":null,""PropertyHasValue"":true,""Description"":""The property 'TheProperty' was expected to be Null.""}", c.GetState(j)); }
public void IsNullIsTrue() { var o = GetJ(@"{ ""TheProperty"" : null }"); IsNull isnull = new IsNull("TheProperty"); Assert.IsTrue(isnull.Evaluate(o)); }
public void IsNullIsFalse() { var o = GetJ(@"{ ""TheProperty"" : ""TheValue"" }"); IsNull isnull = new IsNull("TheProperty"); Assert.IsFalse(isnull.Evaluate(o)); }
public void TwoConstraintsWithRehydration() { var s = Moksy.Common.SimulationFactory.When.I.Get().From("/Pet"); LengthEquals c = new LengthEquals("TheProperty", 10); s.Constraint(c); IsNull n = new IsNull("TheOtherProperty"); s.Constraint(n); Assert.AreEqual(2, s.Constraints.Count); var settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects }; var json = JsonConvert.SerializeObject(s, settings); var h = JsonConvert.DeserializeObject<SimulationCondition>(json, settings); Assert.AreEqual(2, h.Constraints.Count); }
public void IsNullPropertyNull() { var o = GetJ(@"{ ""TheProperty"" : null }"); IsNull isnull = new IsNull(null); Assert.IsFalse(isnull.Evaluate(o)); }
public void IsNullJobNull() { IsNull isnull = new IsNull("TheProperty"); Assert.IsFalse(isnull.Evaluate(null)); }