public async Task Should_map_Remove_and_return_the_expected_ninja() { // Arrange var clanName = "My clan"; var ninjaKey = "123FB950-57DB-4CD0-B4D1-7E6B00A6163A"; var deletedEntity = new NinjaEntity(); var expectedNinja = new Ninja(); NinjaEntityTableStorageRepositoryMock .Setup(x => x.DeleteOneAsync(clanName, ninjaKey)) .ReturnsAsync(deletedEntity) .Verifiable(); NinjaMappingServiceMock .Setup(x => x.Map(deletedEntity)) .Returns(expectedNinja) .Verifiable(); // Act var result = await RepositoryUnderTest.DeleteAsync(clanName, ninjaKey); // Assert NinjaEntityTableStorageRepositoryMock.Verify(x => x.DeleteOneAsync(clanName, ninjaKey), Times.Once); NinjaMappingServiceMock.Verify(x => x.Map(deletedEntity), Times.Once); Assert.Same(expectedNinja, result); }
public async Task DeleteAsync_Returns_Null_When_WorkoutDoesNotExist() { // Arrange const int id = 1; // Act var result = await RepositoryUnderTest.DeleteAsync(id); // Assert Assert.Null(result); }
public async Task DeleteAsync_Deletes_And_Returns_Workout() { // Arrange var expectedWorkout = new Workout { Name = "Test workout 01" }; TrainingPlanContextMock.Workouts.Add(expectedWorkout); await TrainingPlanContextMock.SaveChangesAsync(); var id = expectedWorkout.Id; // Act var result = await RepositoryUnderTest.DeleteAsync(id); // Assert Assert.Same(expectedWorkout, result); }
public async Task Deve_remover_o_usuario() { // Arrange var id = Guid.NewGuid(); var deletedUser = new User { Id = id, Email = "*****@*****.**", Name = "Exemplo Teste", Password = "******" }; await AgendaVoluntariaDatabaseMock.AddAsync(deletedUser); // Act var result = await RepositoryUnderTest.DeleteAsync(id); // Assert Assert.Equal(1, result); }
public async Task Should_throw_a_NotSupportedException() { // Arrange, Act, Assert var exception = await Assert.ThrowsAsync <NotSupportedException>(() => RepositoryUnderTest.DeleteAsync(null)); }
public async Task ShouldDeleteAndReturnTheSpecifiedClan() { var exception = await Assert.ThrowsAsync <NotSupportedException>(() => RepositoryUnderTest.DeleteAsync("My Clan")); }