Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Commit

Permalink
Reduce code duplication in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed Sep 1, 2016
1 parent 647097d commit 45be1b9
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions CakeMail.RestClient.UnitTests/Lists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,7 @@ public async Task CreateList_with_minimal_parameters()
}

[TestMethod]
public async Task CreateList_with_spampolicyaccepted_false()
{
// Arrange
var name = "My new list";
var defaultSenderName = "Bob Smith";
var defaultSenderAddress = "bobsmith@fictitiouscompany.com";
var listId = 12345L;
var parameters = new[]
{
new Parameter { Type = ParameterType.GetOrPost, Name = "name", Value = name },
new Parameter { Type = ParameterType.GetOrPost, Name = "sender_name", Value = defaultSenderName },
new Parameter { Type = ParameterType.GetOrPost, Name = "sender_email", Value = defaultSenderAddress }
};
var jsonResponse = string.Format("{{\"status\":\"success\",\"data\":\"{0}\"}}", listId);
var mockRestClient = new MockRestClient("/List/Create/", parameters, jsonResponse);

// Act
var apiClient = new CakeMailRestClient(MockRestClient.API_KEY, mockRestClient.Object);
var result = await apiClient.Lists.CreateAsync(MockRestClient.USER_KEY, name, defaultSenderName, defaultSenderAddress, spamPolicyAccepted: false);

// Assert
mockRestClient.Verify();
Assert.AreEqual(listId, result);
}

[TestMethod]
public async Task CreateList_with_spampolicyaccepted_true()
public async Task CreateList_with_spampolicyaccepted()
{
// Arrange
var name = "My new list";
Expand Down

0 comments on commit 45be1b9

Please sign in to comment.