public LifeExpectancyShould()
        {
            var mockConfiguration    = new Mock <IConfiguration>();                                                   // Moq
            var mockCountriesService = new Mock <ICountriesService>();                                                // Moq

            lifeExpectancyService = new LifeExpectancyService(mockConfiguration.Object, mockCountriesService.Object); // Moq
        }
Example #2
0
        public async void HaveRemainingLifeExpectancyYearsInRange()
        {
            var cache            = new MemoryCache(new MemoryCacheOptions());
            var countriesService = new CountriesService(cache);
            var configuration    = TestUtilities.ConfigurationRoot();
            var lifeExpectancyServiceIntegration = new LifeExpectancyService(configuration, countriesService);

            var wlr = new WeekendsLeftRequest
            {
                Age     = 82,
                Gender  = Gender.Male,
                Country = "USA"
            };

            // Act
            var remainingLifeExpectancyYears = await lifeExpectancyServiceIntegration.GetRemainingLifeExpectancyYearsAsync(wlr); //.Result;

            // Assert
            Assert.InRange(remainingLifeExpectancyYears, 2, 10); // 7.77 on 5/10/2020
        }