private async Task <List <ProviderViewModel> > GenerateProviders(int qty, int qtyAddress, int qtyContact, bool isValidAddress = true, bool isValidContact = true) { var cityApiTest = new CityApiTest(_integrationTestFixture); await cityApiTest.AddCityAsync(20); var cities = await cityApiTest.GetCitiesAsync(); var providerFixture = new ProviderTestFixture(); var providers = providerFixture.GenerateValidProviderViewModel(qty, cities, qtyAddress, qtyContact, isValidAddress, isValidContact); return(providers); }
public async Task Add_AddNewClientWithIvalidAddress_ShouldNotAddAndReturnNotifications() { //Arrange var cityApiTest = new CityApiTest(_integrationTestFixture); var citiesViewModel = await cityApiTest.GetCitiesAsync(); var clientFixture = new ClientTestFixture(); var clientsViewModel = clientFixture.GenerateClientViewModel(qtyClients: 1, citiesViewModel: citiesViewModel, qtyAddress: 1, isValidAddress: false); //and act var postResponse = await _integrationTestFixture.Client.PostAsJsonAsync(_requestAdd, clientsViewModel.FirstOrDefault()); //Assert var jsonResponse = await postResponse.Content.ReadAsStringAsync(); var clientDeserialized = JsonConvert.DeserializeObject <Deserialize <ClientViewModel> >(jsonResponse); Assert.False(clientDeserialized.Success); Assert.Contains(ConstantMessages.StreetRequiredt_PT, clientDeserialized.Errors); Assert.Contains(ConstantMessages.DistrictRequired_PT, clientDeserialized.Errors); }