public async Task Testing_ForEmptyData_On_SaveGame() { // Arrange var mockRepo = new Mock <IBettingRepository>(); var uowRepo = new Mock <IUnitOfWork>(); mockRepo.Setup(repo => repo.AddGameAsync(It.IsAny <GameInfo>())); uowRepo.Setup(repo => repo.CompleteAsync()); var _sut = new BettingOperationService(mockRepo.Object, uowRepo.Object); CreateGameDto dto = new CreateGameDto(); dto.GameStartTime = DateTime.Now.ToString(); //Act var result = await _sut.AddGame(dto); Assert.IsType <Response <GamePreviewDto> >(result); Assert.Same(result.Message, "Game information successfully save"); }
public async Task Testing_Invalid_DataTime_Value() { // Arrange var mockRepo = new Mock <IBettingRepository>(); var uowRepo = new Mock <IUnitOfWork>(); mockRepo.Setup(repo => repo.AddGameAsync(It.IsAny <GameInfo>())); uowRepo.Setup(repo => repo.CompleteAsync()); var _sut = new BettingOperationService(mockRepo.Object, uowRepo.Object); CreateGameDto dto = new CreateGameDto(); dto.GameStartTime = "1"; //Act var result = await _sut.AddGame(dto); Assert.IsType <Response <GamePreviewDto> >(result); Assert.Same(result.Message, "Internal error occured , please try again"); }