public void TestValidationModeratorAnd() { var moderator = new FarmVisitor(); var result = moderator.Visit(GetModelWhenCardsAndMinerChecked(LocicalBinaryOperator.and)); Assert.AreEqual(result.IsValid, false); }
public void TestValidationModerator() { var moderator = new FarmVisitor(); var result = moderator.Validate(GetModelWhenCardsAndMinerChecked(LocicalBinaryOperator.or), FakeState()); Assert.AreEqual(result.IsValid, true); }
public void TestSerializationModerator() { var seria = BinarySerializer.SerializeToString(GetModelWhenCardsAndMinerChecked(LocicalBinaryOperator.or)); var deSeria = BinarySerializer.DeserializeFromString <IBaseConditionModel>(seria); var moderator = new FarmVisitor(); var result = moderator.Validate(deSeria, FakeState()); Assert.AreEqual(result.IsValid, true); }
public void TestValidationCoolectionAnyModerator() { var model = new UnaryOperation() { Operand = new PropertyCollectionOperation { Collection = new[] { new ContextProperty { DynamicValue = (ctx) => ctx.Card(1, x => x.TempLimit.Current) }, new ContextProperty { DynamicValue = (ctx) => ctx.Card(2, x => x.TempLimit.Current) }, new ContextProperty { DynamicValue = (ctx) => ctx.Card(3, x => x.TempLimit.Current) }, new ContextProperty { DynamicValue = (ctx) => ctx.Card(4, x => x.TempLimit.Current) }, new ContextProperty { DynamicValue = (ctx) => ctx.Card(5, x => x.TempLimit.Current) }, }, Operator = CollectionOperator.Contains, Property = new BaseProperty { Value = 0 } } }; var moderator = new FarmVisitor(); var result = moderator.Validate(model, FakeState()); Assert.AreEqual(result.IsValid, true); }