public void GetState_ReturnsState() { // arrange var mockLogger = MockRepository.Mock <Serilog.ILogger>(); const StateEnumV1 initialState = StateEnumV1.Enabled; var mockStateContainer = MockRepository.Mock <IStateContainer <DataStructureV1> >(); mockStateContainer.Stub(container => container.State).Return(initialState).Repeat.Once(); var stateMachine = new StateMachineV1(mockStateContainer, mockLogger); // act StateEnumV1 returnedState = stateMachine.GetState(); // assert Assert.AreEqual(initialState, returnedState); mockStateContainer.AssertWasCalled(container => container.State); mockStateContainer.AssertWasNotCalled(container => container.PrevState); mockStateContainer.AssertWasNotCalled(container => container.Data); }
public void GetData_ReturnsData() { // arrange var mockLogger = MockRepository.Mock <Serilog.ILogger>(); var initialData = new DataStructureV1(); var mockStateContainer = MockRepository.Mock <IStateContainer <DataStructureV1> >(); mockStateContainer.Stub(container => container.Data).Return(initialData).Repeat.Once(); var stateMachine = new StateMachineV1(mockStateContainer, mockLogger); // act DataStructureV1 returnedData = stateMachine.GetData(); // assert Assert.AreEqual(initialData, returnedData); mockStateContainer.AssertWasNotCalled(container => container.State); mockStateContainer.AssertWasNotCalled(container => container.PrevState); mockStateContainer.AssertWasCalled(container => container.Data); }