public List <City> GenerateCity(int qty) { var faker = new Faker <City>("pt_BR"); var stateFixture = new StateTestFixture(); return(faker.CustomInstantiator(f => new City(Guid.NewGuid(), f.Address.City(), stateFixture.GenerateValidState())).Generate(qty)); }
public List <CountryViewModel> GenerateCountryViewModel(int qty, bool withState = true, bool validState = true, int qtyOfState = 0) { var stateFixture = new StateTestFixture(); var country = new Faker <CountryViewModel>("pt_BR").RuleFor(c => c.Name, f => f.Address.Country()) .FinishWith((f, c) => { if (withState) { if (validState) { c.States = stateFixture.GenerateStatesViewModel(qtyOfState); } else { c.States = new List <StateViewModel> { stateFixture.GenerateInvalidStateViewModel() }; } } }); return(country.Generate(qty)); }
public Country GenerateValidCountryWithStates() { var stateFixture = new StateTestFixture(); var country = GenerateValidCountry(); country.AddStates(stateFixture.GenerateStates(quantity: 3, country: country)); return(country); }
public Country GenerateValidCountryWithInvalidStates() { var country = GenerateValidCountry(); var stateFixture = new StateTestFixture(); country.AddState(stateFixture.GenerateInvalidState()); country.AddState(stateFixture.GenerateInvalidState()); country.AddState(stateFixture.GenerateInvalidState()); return(country); }
public Country GenerateInvalidCountryWithStates() { var country = new Country(Guid.NewGuid(), ""); var stateFixture = new StateTestFixture(); country.AddState(stateFixture.GenerateInvalidState()); country.AddState(stateFixture.GenerateInvalidState()); country.AddState(stateFixture.GenerateInvalidState()); return(country); }
public dynamic GenerateExpectedCity() { var faker = new Faker("pt_BR"); var stateFixture = new StateTestFixture(); return(new { Id = Guid.NewGuid(), Name = faker.Address.City(), State = stateFixture.GenerateStateValidExpected(), }); }
public dynamic GenerateAddressExpected() { var stateFixture = new StateTestFixture(); var faker = new Faker("pt_BR"); return(new { Id = Guid.NewGuid(), ZipCode = faker.Address.ZipCode(), Street = faker.Address.StreetAddress(), Number = faker.Random.Number(1, 9999).ToString(), Complement = faker.Address.SecondaryAddress(), District = faker.Address.Direction(), State = stateFixture.GenerateStateWithCountryValidExpected(), CityId = Guid.NewGuid(), CityName = faker.Address.City() }); }
internal async Task AddNewStateAsync(int qty) { for (int i = 0; i < qty; i++) { var countryApi = new CountryApiTest(_integrationTestFixture); await countryApi.AddNewCountriesAsync(1, false); var countriesViewModel = await GetAllCountriesAsync(1, 5); var countryViewModel = countriesViewModel.FirstOrDefault(); var stateFixture = new StateTestFixture(); var state = stateFixture.GenerateValidStateViewModel(); state.CountryId = countryViewModel.Id.GetValueOrDefault(); var postResponse = await _integrationTestFixture.Client.PostAsJsonAsync(requestAdd, state); postResponse.EnsureSuccessStatusCode(); } }
public dynamic GenerateStateValidExpected() { var stateFixture = new StateTestFixture(); return(stateFixture.GenerateStateValidExpected()); }
public StateServiceTest(StateTestFixture stateTestFixture) { _stateTestFixture = stateTestFixture; }
public StateDomainTest(StateTestFixture stateTestFixture) { _stateTestFixture = stateTestFixture; }