コード例 #1
0
        public void WhenProcessingInput_Then_Output_EqualsInput()
        {
            const double input = 3d;
            var          sut   = new IdentityIndicator();

            sut.Process(input);
            Assert.AreEqual(input, sut.Output);
        }
コード例 #2
0
        public void WhenChainingIndicatorsUsingOf_Then_FirstIndicatorOutput_IsForwarded_ToSecondIndicatorInput()
        {
            var first  = new IdentityIndicator();
            var second = new IdentityIndicator();

            second.Of(first, true);

            first.Process(1);

            Assert.AreEqual(1, second.Output);
        }
コード例 #3
0
        public void WhenProcessingInput_Then_OutputUpdated_IsRaised()
        {
            var sut = new IdentityIndicator();


            var output = 0d;

            sut.OutputUpdated += (sender, o) => output = o;
            sut.Process(1);

            Assert.AreEqual(1, output);
        }
コード例 #4
0
        public void WhenProcessingDataByLeftOrRightIndicator_Then_OutputUpdated_IsRaised()
        {
            var left  = new IdentityIndicator();
            var right = new IdentityIndicator();
            var sut   = new CompositeIndicator(left, right, (l, r) => l.Output + r.Output);

            var output = 0d;

            sut.OutputUpdated += (sender, o) => output = o;

            left.Process(1);
            Assert.AreEqual(1, output);

            right.Process(2);
            Assert.AreEqual(3, output);
        }
コード例 #5
0
        public void WhenConstructingNewInstance_Then_IsReady_IsFalse()
        {
            var sut = new IdentityIndicator();

            Assert.IsFalse(sut.IsReady);
        }
コード例 #6
0
        public void WhenConstructingNewInstance_Then_Output_IsZero()
        {
            var sut = new IdentityIndicator();

            Assert.AreEqual(0, sut.Output);
        }