public async Task Handle_NullRequest_ThrowsArgumentNullException(DeleteEndpointHandler subject) { // Arrange // Act Func <Task> act = () => subject.Handle(null, default); // Assert await act.Should().ThrowExactlyAsync <ArgumentNullException>(); }
public async Task Handle_EndpointExists_ReturnsUnit( [Frozen] LandisGyrContext context, Endpoint endpoint, DeleteEndpointHandler subject) { // Arrange context.Endpoints.Add(endpoint); await context.SaveChangesAsync(); // Act var result = await subject.Handle(new DeleteEndpoint { SerialNumber = endpoint.SerialNumber }, default); // Assert result.Should().NotBeNull(); context.Endpoints.Should().BeEmpty(); }
public async Task Handle_EndpointNotFound_ThrowsKeyNotFoundException(DeleteEndpoint request, DeleteEndpointHandler subject) { // Arrange // Act Func <Task> act = () => subject.Handle(request, default); // Assert await act.Should().ThrowExactlyAsync <KeyNotFoundException>(); }