예제 #1
0
        public void Should_Apply_Not_Operand(bool value)
        {
            var fakeTrigger = A.Fake <ITrigger>();

            A.CallTo(() => fakeTrigger.WillAffect()).Returns(value);

            var trigger = new CombinedTrigger {
                Second = fakeTrigger
            };

            Assert.NotEqual(value, trigger.WillAffect());
        }
예제 #2
0
        internal void Should_Apply_And_Or_Xor_Operands(Logical operand, bool firstTriggerValue, bool secondTriggerValue, bool expected)
        {
            var firstTrigger = A.Fake <ITrigger>();

            A.CallTo(() => firstTrigger.WillAffect()).Returns(firstTriggerValue);
            var secondTrigger = A.Fake <ITrigger>();

            A.CallTo(() => secondTrigger.WillAffect()).Returns(secondTriggerValue);

            var trigger = new CombinedTrigger(operand, firstTrigger)
            {
                Second = secondTrigger
            };

            Assert.Equal(expected, trigger.WillAffect());
        }
예제 #3
0
        internal void Should_Throw_InvalidOperationException_When_Missing_SecondTrigger_For_And_Or_Xor_Operands(Logical operand)
        {
            var trigger = new CombinedTrigger(operand, new RandomTrigger());

            Assert.Throws <InvalidOperationException>(() => trigger.WillAffect());
        }
예제 #4
0
        public void Should_Throw_InvalidOperationException_When_Missing_SecondTrigger_For_Not_Operand()
        {
            var trigger = new CombinedTrigger();

            Assert.Throws <InvalidOperationException>(() => trigger.WillAffect());
        }