Beispiel #1
0
        public async Task ShouldReturnInternalServerErrorWhenGetSystemInfoCalledWithError()
        {
            //Given
            _swarmClient.When(x => x.GetSystemInfo()).Do(_ => throw new ArgumentException());
            var systemService     = new SwarmApi.Services.SystemService(_swarmClient, _loggerFactory);
            var serviceController = new SystemController(systemService);

            //When
            var response = await serviceController.GetSystemInfo();

            var result = response as ContentResult;

            //Then
            Assert.NotNull(result);
            Assert.Equal(500, result.StatusCode);
        }
Beispiel #2
0
        public async Task ShouldReturnInternalServerErrorWhenGetServicesCalledAndErrorOccour()
        {
            //Given
            _swarmClient.When(x => {
                x.GetServices();
            }).Do(_ => { throw new Exception(); });
            var swarmService      = new SwarmApi.Services.SwarmService(_swarmClient, _loggerFactory);
            var serviceController = new SwarmController(swarmService);

            //When
            var response = await serviceController.GetService();

            var result = response as ContentResult;

            //Then
            Assert.NotNull(result);
            Assert.Equal(500, result.StatusCode);
        }