public async Task WhenBusinessesAreQueriedViaEntityFrameworkAsync() { Suts = await _dbContext.Business.Take(10).ToListAsync(); Sut = Suts.FirstOrDefault(); SutKey = Sut.BusinessKey; }
public async Task WhenBusinessIsQueriedByKeyViaAzureFunction() { var client = new HttpClientJson <Business>(); var response = await client.GetAsync(new Uri($"{_config["Stack:Subjects:FunctionsUrl"]}/api/BusinessGet?code={_config["Stack:Subjects:FunctionsCode"]}&key={SutKey}")); Assert.IsTrue(response.IsSuccessStatusCode); var result = await response.Content.ReadAsStringAsync(); Suts.Add(JsonConvert.DeserializeObject <Business>(result)); Sut = Suts.FirstOrDefault(); SutKey = Sut.BusinessKey; }
public async Task WhenBusinessesAreQueriedViaWebAPI() { var client = new HttpClientJson <Business>(); var response = await client.GetAsync(new Uri($"{_config["Stack:Subjects:ApiUrl"]}/v1/Businesses")); Assert.IsTrue(response.IsSuccessStatusCode); var result = await response.Content.ReadAsStringAsync(); Suts = JsonConvert.DeserializeObject <List <Business> >(result).Take(5).ToList(); Sut = Suts.FirstOrDefault(); SutKey = Sut.BusinessKey; }
public async Task ThenTheBusinessIsInsertedToPersistenceFromTheWebAPI() { var client = new HttpClientJson <Business>(); var response = await client.GetAsync(new Uri($"{_config["Stack:Subjects:ApiUrl"]}/v1/Businesses/{SutKey}")); Assert.IsTrue(response.IsSuccessStatusCode); var result = await response.Content.ReadAsStringAsync(); Suts.Add(JsonConvert.DeserializeObject <Business>(result)); Sut = Suts.FirstOrDefault(); SutKey = Sut.BusinessKey; Assert.IsTrue(SutKey != Guid.Empty); }
public async Task WhenBusinessIsPostedViaAzureFunction() { var client = new HttpClientJson <Business>(); var response = await client.PutAsync(new Uri($"{_config["Stack:Subjects:FunctionsUrl"]}/api/BusinessUpdate?code={_config["Stack:Subjects:FunctionsCode"]}&key={SutKey}"), new StringContent(JsonConvert.SerializeObject(Sut), Encoding.UTF8, "application/json")); Assert.IsTrue(response.IsSuccessStatusCode); var result = await response.Content.ReadAsStringAsync(); Suts.Add(JsonConvert.DeserializeObject <Business>(result)); Sut = Suts.FirstOrDefault(); SutKey = Sut.BusinessKey; RecycleBin.Add(Sut); }
public async Task WhenBusinessIsPostedViaWebAPI() { var client = new HttpClientJson <Business>(); var url = new Uri($"{_config["Stack:Subjects:ApiUrl"]}/v1/Businesses/{SutKey}"); var response = await client.PutAsync(url, new StringContent(JsonConvert.SerializeObject(Sut), Encoding.UTF8, "application/json")); Assert.IsTrue(response.IsSuccessStatusCode); var result = await response.Content.ReadAsStringAsync(); Suts.Add(JsonConvert.DeserializeObject <Business>(result)); Sut = Suts.FirstOrDefault(); SutKey = Sut.BusinessKey; Assert.IsTrue(SutKey != Guid.Empty); }
public async Task WhenSchedulesAreQueriedViaEntityFrameworkAsync() { Suts = await _dbContext.Schedule.Take(10).ToListAsync(); Sut = Suts.FirstOrDefault(); }