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));
 }
Example #2
0
 public void IsNullIsTrue()
 {
     var o = GetJ(@"{ ""TheProperty"" : null }");
     IsNull isnull = new IsNull("TheProperty");
     Assert.IsTrue(isnull.Evaluate(o));
 }
Example #3
0
 public void IsNullIsFalse()
 {
     var o = GetJ(@"{ ""TheProperty"" : ""TheValue"" }");
     IsNull isnull = new IsNull("TheProperty");
     Assert.IsFalse(isnull.Evaluate(o));
 }
Example #4
0
        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);
        }
Example #5
0
 public void IsNullPropertyNull()
 {
     var o = GetJ(@"{ ""TheProperty"" : null }");
     IsNull isnull = new IsNull(null);
     Assert.IsFalse(isnull.Evaluate(o));
 }
Example #6
0
 public void IsNullJobNull()
 {
     IsNull isnull = new IsNull("TheProperty");
     Assert.IsFalse(isnull.Evaluate(null));
 }