コード例 #1
0
        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; }
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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; }
        }
コード例 #4
0
        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; }
        }