Пример #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);
        }
        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());
 }
 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());
 }