public async Task GetAchievementById_ShouldReturnAchievement_WhenAchievementExists() { // Arange var Id = Guid.NewGuid(); var CancellationToken = new CancellationToken(); var AchievementResult = new Achievement() { Id = Id, }; AchievementRepoMock.Setup(x => x.GetById(Id, CancellationToken)) .ReturnsAsync(AchievementResult).Verifiable(); UnitOfWorkMock.Setup(m => m.AchievementRepository).Returns(AchievementRepoMock.Object); AchievementService _AchievementService = new AchievementService(UnitOfWorkMock.Object, MapperMock.Object); // Act var Achievement = await _AchievementService.GetAchievementById(Id, CancellationToken); // Assert Assert.IsNotNull(Achievement); AchievementRepoMock.Verify(); Assert.AreEqual(AchievementResult.Id, Achievement.Id); }
public void GetAchievementByKey_KeyAchievementDoesNotExists_Null() { var actual = m_target.GetAchievementById(0); Assert.IsNull(actual); }