public void IsGameStopped_ShouldCallGamePropertyRepositoryMockOnce_WhenTheCorrectRepositoryIsPassed() { var gamePropertyRepositoryMock = MockRepository.GenerateMock <IGamePropertyRepository>(); //Arrange gamePropertyRepositoryMock.Expect(dao => dao.GetDate()).Return(Arg <GameProperties> .Is.Anything).Repeat.Once(); var gamePropertyService = new GamePropertyService(gamePropertyRepositoryMock); //Act gamePropertyService.IsGameStopped(); //Assert gamePropertyRepositoryMock.VerifyAllExpectations(); }
public void IsGameStopped_ShouldReturnFalse_WhenThePassedDateIsInTheFeuture() { var gamePropertyRepositoryMock = MockRepository.GenerateMock <IGamePropertyRepository>(); //Arrange var returnedDate = DateTime.MaxValue; var gamePropertyEntity = new GameProperties(); gamePropertyEntity.StopGameDate = returnedDate; gamePropertyRepositoryMock.Expect(dao => dao.GetDate()).Return(gamePropertyEntity); var gamePropertyService = new GamePropertyService(gamePropertyRepositoryMock); //Act bool recievedValue = gamePropertyService.IsGameStopped(); //Assert Assert.AreEqual(false, recievedValue); }
public void IsGameStopped_ShouldReturnTrue_WhenThePassedDateIsInThePast() { //Arrange var gamePropertyRepositoryMock = MockRepository.GenerateMock <IGamePropertyRepository>(); var returnedDate = DateTime.MinValue; var gamePropertyEntity = new GameProperties(); gamePropertyEntity.StopGameDate = returnedDate; gamePropertyRepositoryMock.Expect(dao => dao.GetDate()).Return(gamePropertyEntity); var unitOfWorkMockMock = MockRepository.GenerateStub <IUnitOfWork>(); unitOfWorkMockMock.Stub(uow => uow.GamePropertyRepository).Return(gamePropertyRepositoryMock); var gamePropertyService = new GamePropertyService(unitOfWorkMockMock); //Act bool recievedValue = gamePropertyService.IsGameStopped(); //Assert Assert.AreEqual(true, recievedValue); }