예제 #1
0
        public async Task ShouldReturnOkBothServices()
        {
            IOptions <AppSettingsModel> settings = Options.Create(TestHelper.GetApplicationConfiguration());

            var httpClientFactoryMock = await TestHelper.GetMockHttpClientFactoryAsync(settings);

            var dataSource = new JSONDataSource(settings);

            var genericService = new GenericService(dataSource);

            var developersService = new DevelopersService(dataSource, httpClientFactoryMock, settings);

            var controller = new DevelopersController(genericService, developersService);

            var data = await controller.GetAllAsync();

            Assert.NotEmpty(data);

            data = await controller.GetSkilledAsync();

            Assert.NotEmpty(data);

            foreach (var dev in data)
            {
                Assert.True(dev.Skills.Count() >= 1);

                Assert.Contains(dev.Skills, s => s.Level >= 8);

                Assert.True(dev.Skills.Select(s => s.Type).Distinct().Count() == 1);
            }
        }
예제 #2
0
        public async Task ShouldGetData()
        {
            IOptions <AppSettingsModel> settings = Options.Create(TestHelper.GetApplicationConfiguration());

            var httpClientFactoryMock = await TestHelper.GetMockHttpClientFactoryAsync(settings);

            var dataSource = new JSONDataSource(settings);

            var service = new DevelopersService(dataSource, httpClientFactoryMock, settings);

            var data = await service.GetAllAsync();

            Assert.NotEmpty(data);

            data = await service.GetSkilledAsync();

            Assert.NotEmpty(data);
        }