public async Task CRUD_IGovernmentServices_Add_State_Delete_State_Success_Async()
        {
            var serviceProvider = _factory.Server.Services;

            using (var scope = serviceProvider.CreateScope())
            {
                var sp = scope.ServiceProvider;
                var governmentServices = sp.GetRequiredService <IGovernmentServices>();
                governmentServices.Should().NotBeNull();

                var appEntityCoreContext = sp.GetRequiredService <IAppEntityCoreContext>();
                appEntityCoreContext.Should().NotBeNull();

                var dbContext = appEntityCoreContext.DbContext;
                var dbExists  = await appEntityCoreContext.DbContext.Database.CanConnectAsync();

                dbExists.Should().BeTrue();

                var utcNow = DateTime.UtcNow;

                var state = new WebApp.Models.State
                {
                    Created      = utcNow,
                    Updated      = utcNow,
                    Name         = "New California",
                    Abbreviation = "NCA"
                };

                Func <Task> func = async() => { await governmentServices.UpsertStateAsync(state); };
                func.Should().NotThrow();


                var ori = await governmentServices.GetStateByAbbreviationAsync(state.Abbreviation);

                ori.Should().NotBeNull();
                ori.Abbreviation.Should().Be(state.Abbreviation);

                func = async() => { await governmentServices.DeleteStateAsync(ori.Id); };
                func.Should().NotThrow();

                ori = await governmentServices.GetStateByAbbreviationAsync(state.Abbreviation);

                ori.Should().BeNull();
            }
        }
        public async Task CRUD_IGovernmentServices_Update_City_Success_Async()
        {
            var serviceProvider = _factory.Server.Services;

            using (var scope = serviceProvider.CreateScope())
            {
                var sp = scope.ServiceProvider;
                var governmentServices = sp.GetRequiredService <IGovernmentServices>();
                governmentServices.Should().NotBeNull();

                var appEntityCoreContext = sp.GetRequiredService <IAppEntityCoreContext>();
                appEntityCoreContext.Should().NotBeNull();

                var dbContext = appEntityCoreContext.DbContext;
                var dbExists  = await appEntityCoreContext.DbContext.Database.CanConnectAsync();

                dbExists.Should().BeTrue();


                var utcNow = DateTime.UtcNow;

                var state = new WebApp.Models.State
                {
                    Created      = utcNow,
                    Updated      = utcNow,
                    Name         = "Old California",
                    Abbreviation = "OCA"
                };
                var county = new County
                {
                    Name = "Toole"
                };
                var city = new City
                {
                    Name = "Sunburst"
                };

                Func <Task> func = async() =>
                {
                    await governmentServices.UpsertStateAsync(state);
                };
                func.Should().NotThrow();
                var stateInDb = await governmentServices.GetStateByAbbreviationAsync(state.Abbreviation);

                func = async() =>
                {
                    await governmentServices.UpsertCountyAsync(stateInDb.Id, county);
                };
                func.Should().NotThrow();
                var countyInDb = await governmentServices.GetCountyByNameAsync(stateInDb.Id, county.Name);

                countyInDb.Should().NotBeNull();

                func = async() =>
                {
                    await governmentServices.UpsertCityAsync(
                        stateInDb.Id,
                        countyInDb.Id,
                        city);
                };
                func.Should().NotThrow();

                var cities = await governmentServices
                             .GetCitiesAsync(stateInDb.Id, countyInDb.Id);

                cities.Should().NotBeNull();
                cities.Count().Should().Be(1);

                var cityInDb = await governmentServices.GetCityByIdAsync(stateInDb.Id,
                                                                         countyInDb.Id, cities[0].Id);

                cityInDb.Should().NotBeNull();
                cityInDb.Name.Should().Be(city.Name);

                cityInDb.Name = "Sweetgrass";
                func          = async() =>
                {
                    await governmentServices.UpsertCityAsync(
                        stateInDb.Id,
                        countyInDb.Id,
                        cityInDb);
                };
                func.Should().NotThrow();

                var cityInDb2 = await governmentServices.GetCityByIdAsync(
                    stateInDb.Id,
                    countyInDb.Id,
                    cityInDb.Id);

                cityInDb2.Should().NotBeNull();
                cityInDb2.Name.Should().Be(cityInDb.Name);



                func = async() => { await governmentServices.DeleteStateAsync(stateInDb.Id); };
                func.Should().NotThrow();

                stateInDb = await governmentServices.GetStateByAbbreviationAsync(stateInDb.Abbreviation);

                stateInDb.Should().BeNull();
            }
        }