public async Task ShouldSaveEmail() { await Login(); var email = EmailFakers.GenerateEmail().Generate(); var httpResponse = await _client.PutAsync($"/emails/{email.Type}", new StringContent(email.ToJson(), Encoding.UTF8, MediaTypeNames.Application.Json)); try { httpResponse.EnsureSuccessStatusCode(); } catch { _output.WriteLine(await httpResponse.Content.ReadAsStringAsync()); throw; } }
public async Task ShouldSaveTemplates() { await Login(); var email = EmailFakers.GenerateTemplate().Generate(); var httpResponse = await _client.PostAsync("/emails/templates", new StringContent(email.ToJson(), Encoding.UTF8, MediaTypeNames.Application.Json)); try { httpResponse.EnsureSuccessStatusCode(); } catch { _output.WriteLine(await httpResponse.Content.ReadAsStringAsync()); throw; } httpResponse.Headers.Location.Should().NotBeNull(); httpResponse.Headers.Location.PathAndQuery.Should().Contain("/emails"); }
public async Task ShouldRemoveTemplates() { await Login(); var email = EmailFakers.GenerateTemplate().Generate(); await Insert(email); var httpResponse = await _client.DeleteAsync($"/emails/templates/{email.Name}"); try { httpResponse.EnsureSuccessStatusCode(); } catch { _output.WriteLine(await httpResponse.Content.ReadAsStringAsync()); throw; } }
public async Task ShouldUpdateTemplates() { await Login(); var email = EmailFakers.GenerateTemplate().Generate(); await Insert(email); email.OldName = email.Name; email.Name = _faker.Internet.DomainName(); var httpResponse = await _client.PutAsync($"/emails/templates/{email.OldName}", new StringContent(email.ToJson(), Encoding.UTF8, MediaTypeNames.Application.Json)); try { httpResponse.EnsureSuccessStatusCode(); } catch { _output.WriteLine(await httpResponse.Content.ReadAsStringAsync()); throw; } }