public async Task Creating_Achievement_ShouldCreateProjection() { using (var connection = this._testInfrastructure.OpenDatabaseConnection()) { // Arrange var commandDispatcher = this._testInfrastructure.DiContainer.GetInstance <IMediator>(); var repository = new AchievementRepository(); var command = new CreateAchievementCommand("Test", 1, 5); // Act var newAchievement = await commandDispatcher.Send(command); var projection = await repository.GetByIdAsync(connection, newAchievement.AchievementId); // Assert Assert.That(newAchievement.AchievementId, Is.Not.EqualTo(Guid.Empty)); Assert.That(projection, Is.Not.Null); Assert.That(projection.AchievementId, Is.EqualTo(newAchievement.AchievementId)); Assert.That(projection.Name, Is.EqualTo(command.Name)); } }
public async Task CompletingAchievement_ShouldCompleteProjection() { using (var connection = this._testInfrastructure.OpenDatabaseConnection()) { // Arrange var commandDispatcher = this._testInfrastructure.DiContainer.GetInstance <IMediator>(); var repository = new AchievementRepository(); var command = new CreateAchievementCommand("Test", 1, 5); var newAchievement = await commandDispatcher.Send(command); var command2 = new CompleteAchievementCommand(newAchievement.AchievementId); // Act var completedResponse = await commandDispatcher.Send(command2); var projection = await repository.GetByIdAsync(connection, newAchievement.AchievementId); // Assert Assert.That(projection.CompletedOn, Is.Not.Null); } }