public void IsGameNotStartedYet_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.IsGameNotStartedYet(); //Assert gamePropertyRepositoryMock.VerifyAllExpectations(); }
public void IsGameNotStartedYet_ShouldReturnFalse_WhenThePassedDateIsInThePast() { var gamePropertyRepositoryMock = MockRepository.GenerateMock <IGamePropertyRepository>(); //Arrange var returnedDate = DateTime.MinValue; var gamePropertyEntity = new GameProperties(); gamePropertyEntity.StartGameDate = returnedDate; gamePropertyRepositoryMock.Expect(dao => dao.GetDate()).Return(gamePropertyEntity); var gamePropertyService = new GamePropertyService(gamePropertyRepositoryMock); //Act bool recievedValue = gamePropertyService.IsGameNotStartedYet(); //Assert Assert.AreEqual(false, recievedValue); }
public void IsGameNotStartedYet_ShouldReturnTrue_WhenThePassedDateIsInTheFeauture() { //Arrange var gamePropertyRepositoryMock = MockRepository.GenerateMock <IGamePropertyRepository>(); var returnedDate = DateTime.MaxValue; var gamePropertyEntity = new GameProperties(); gamePropertyEntity.StartGameDate = 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.IsGameNotStartedYet(); //Assert Assert.AreEqual(true, recievedValue); }