public async Task Handle_NullRequest_ThrowsArgumentNull(FindEndpointHandler subject) { // Arrange // Act Func <Task> act = () => subject.Handle(null, default); // Assert await act .Should() .ThrowExactlyAsync <ArgumentNullException>(); }
public async Task Handle_EndpointNotFound_ReturnsNull([Frozen] LandisGyrContext context, Endpoint endpoint, FindEndpointHandler subject) { // Arrange context.Add(endpoint); await context.SaveChangesAsync(); // Act var result = await subject.Handle(new FindEndpoint { SerialNumber = string.Empty }, default); // Assert result .Should() .BeNull(); }
public async Task Handle_ExistingContext_ReturnsEndpoint([Frozen] LandisGyrContext context, Endpoint endpoint, FindEndpointHandler subject) { // Arrange context.Add(endpoint); await context.SaveChangesAsync(); // Act var result = await subject.Handle(new FindEndpoint { SerialNumber = endpoint.SerialNumber }, default); // Assert result .Should() .NotBeNull().And .BeEquivalentTo(endpoint); }