예제 #1
0
            public async Task Handle_NullRequest_ThrowsArgumentNullException(DeleteEndpointHandler subject)
            {
                // Arrange

                // Act
                Func <Task> act = () => subject.Handle(null, default);

                // Assert
                await act.Should().ThrowExactlyAsync <ArgumentNullException>();
            }
예제 #2
0
            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();
            }
예제 #3
0
            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>();
            }