Ejemplo n.º 1
0
        public void NegateOrCondition(bool?first, bool?other, bool?third, bool?expected)
        {
            var fake1 = new Fake {
                IsTrueOrNull = first
            };

            using (var condition1 = new Condition(fake1.ObservePropertyChanged(x => x.IsTrueOrNull), () => fake1.IsTrueOrNull))
            {
                var fake2 = new Fake {
                    IsTrueOrNull = other
                };
                using (var condition2 = new Condition(fake2.ObservePropertyChanged(x => x.IsTrueOrNull), () => fake2.IsTrueOrNull))
                {
                    var fake3 = new Fake {
                        IsTrueOrNull = third
                    };
                    using (var condition3 = new Condition(fake3.ObservePropertyChanged(x => x.IsTrueOrNull), () => fake3.IsTrueOrNull))
                    {
                        using (var orCondition = new OrCondition(condition1, condition2, condition3))
                        {
                            using (var negated = orCondition.Negate())
                            {
                                Assert.AreEqual(expected, negated.IsSatisfied);
                            }
                        }
                    }
                }
            }
        }
        public void NegateOrCondition(bool?first, bool?other, bool?third, bool?expected)
        {
            var fake1 = new FakeInpc {
                Prop1 = first
            };
            var condition1 = new Condition(fake1.ToObservable(x => x.Prop1), () => fake1.Prop1);

            var fake2 = new FakeInpc {
                Prop1 = other
            };
            var condition2 = new Condition(fake2.ToObservable(x => x.Prop1), () => fake2.Prop1);

            var fake3 = new FakeInpc {
                Prop1 = third
            };
            var condition3 = new Condition(fake3.ToObservable(x => x.Prop1), () => fake3.Prop1);

            var orCondition = new OrCondition(condition1, condition2, condition3);
            var negated     = orCondition.Negate();

            Assert.AreEqual(expected, negated.IsSatisfied);
        }