コード例 #1
0
        public void Calculate_AddsToLogString_WhenCalled()
        {
            // Arrange
            m_Wire.GetSignal().Returns(true);

            // Act
            m_Sut.Calculate(TimeDoesNotMatter);

            // Assert
            Assert.AreEqual("[0,1]",
                            m_Sut.GetLog());
        }
コード例 #2
0
        public void Calculate_SetsWireOutToFalse_ForWireInIsTrue()
        {
            // Arrange
            Inverter sut = CreateSut(m_WireIn,
                                     m_WireOut);

            m_WireIn.SetSignal(TimeDoesNotMatter,
                               true);

            // Act
            sut.Calculate(0);

            // Assert
            m_WireOut.GetSignal().ShouldBeFalse();
        }
コード例 #3
0
        public void Calculate(int time)
        {
            bool value = m_WireInOne.GetSignal() ||
                         m_WireInTwo.GetSignal();

            m_WireOut.SetSignal(time,
                                value);
        }
コード例 #4
0
        public void ThenTheWireOrOutputIsTrue(string wireName,
                                              bool expected)
        {
            IWire wire = GetWireFromContext(wireName);

            SleepWaitAndDo(() => IsExpectedOutputSignal(expected,
                                                        wire),
                           DoNothing);

            bool actual = wire.GetSignal();

            Assert.AreEqual(expected,
                            actual);
        }
コード例 #5
0
        public void FunctionUnderTest_ExpectedResult_UnderCondition(bool inputOne,
                                                                    bool inputTwo,
                                                                    bool expected)
        {
            // Arrange
            m_WireInOne.GetSignal().Returns(inputOne);
            m_WireInTwo.GetSignal().Returns(inputTwo);

            // Act
            m_Sut.Calculate(0);

            // Assert
            m_WireOut.Received().SetSignal(TimeDoesNotMatter,
                                           expected);
        }
コード例 #6
0
 public bool GetSignal()
 {
     return(m_Wire.GetSignal());
 }
コード例 #7
0
 private bool IsExpectedOutputSignal(bool expected,
                                     IWire wire)
 {
     return(expected == wire.GetSignal());
 }
コード例 #8
0
 public void Calculate(int time)
 {
     m_WireOut.SetSignal(time,
                         !m_WireIn.GetSignal());
 }