From 5d569047c59bcb1e7a7734476064e9a8900ab5c1 Mon Sep 17 00:00:00 2001 From: lvukadinovic-ib Date: Thu, 7 Nov 2024 17:17:30 +0100 Subject: [PATCH] Refactored tests a bit. --- ApiClient.Tests/Api/EmailApiTest.cs | 313 ++++++++++++++-------------- ApiClient.Tests/Api/TfaApiTest.cs | 24 +-- 2 files changed, 169 insertions(+), 168 deletions(-) diff --git a/ApiClient.Tests/Api/EmailApiTest.cs b/ApiClient.Tests/Api/EmailApiTest.cs index 5ed924e..7689640 100644 --- a/ApiClient.Tests/Api/EmailApiTest.cs +++ b/ApiClient.Tests/Api/EmailApiTest.cs @@ -148,21 +148,21 @@ public void ShouldSendEmailTest() replyTo: expectedReplyTo ); - Assert.AreEqual(response.Messages.Count, expectedMessageCount); - Assert.AreEqual(response.Messages[0].MessageId, expectedMessageId); - Assert.AreEqual(response.Messages[0].To, expectedTo); - Assert.AreEqual(response.Messages[0].Status.Id, expectedStatusId); - Assert.AreEqual(response.Messages[0].Status.Name, expectedStatusName); - Assert.AreEqual(response.Messages[0].Status.GroupId, expectedStatusGroupId); - Assert.AreEqual(response.Messages[0].Status.Description, expectedStatusDescription); - Assert.AreEqual(response.Messages[0].Status.GroupId, expectedStatusGroupId); - Assert.AreEqual(response.Messages[1].MessageId, expectedMessageId2); - Assert.AreEqual(response.Messages[1].To, expectedTo2); - Assert.AreEqual(response.Messages[1].Status.Id, expectedStatusId); - Assert.AreEqual(response.Messages[1].Status.Name, expectedStatusName); - Assert.AreEqual(response.Messages[1].Status.GroupId, expectedStatusGroupId); - Assert.AreEqual(response.Messages[1].Status.Description, expectedStatusDescription); - Assert.AreEqual(response.Messages[1].Status.GroupId, expectedStatusGroupId); + Assert.AreEqual(expectedMessageCount, response.Messages.Count); + Assert.AreEqual(expectedMessageId, response.Messages[0].MessageId); + Assert.AreEqual(expectedTo, response.Messages[0].To); + Assert.AreEqual(expectedStatusId, response.Messages[0].Status.Id); + Assert.AreEqual(expectedStatusName, response.Messages[0].Status.Name); + Assert.AreEqual(expectedStatusGroupId, response.Messages[0].Status.GroupId); + Assert.AreEqual(expectedStatusDescription, response.Messages[0].Status.Description); + Assert.AreEqual(expectedStatusGroupId, response.Messages[0].Status.GroupId); + Assert.AreEqual(expectedMessageId2, response.Messages[1].MessageId); + Assert.AreEqual(expectedTo2, response.Messages[1].To); + Assert.AreEqual(expectedStatusId, response.Messages[1].Status.Id); + Assert.AreEqual(expectedStatusName, response.Messages[1].Status.Name); + Assert.AreEqual(expectedStatusGroupId, response.Messages[1].Status.GroupId); + Assert.AreEqual(expectedStatusDescription, response.Messages[1].Status.Description); + Assert.AreEqual(expectedStatusGroupId, response.Messages[1].Status.GroupId); } [TestMethod] @@ -246,14 +246,14 @@ public void ShouldSendEmailWithAttachmentTest() replyTo: expectedReplyTo ); - Assert.AreEqual(response.Messages.Count, expectedMessageCount); - Assert.AreEqual(response.Messages[0].MessageId, expectedMessageId); - Assert.AreEqual(response.Messages[0].To, expectedTo); - Assert.AreEqual(response.Messages[0].Status.Id, expectedStatusId); - Assert.AreEqual(response.Messages[0].Status.Name, expectedStatusName); - Assert.AreEqual(response.Messages[0].Status.GroupId, expectedStatusGroupId); - Assert.AreEqual(response.Messages[0].Status.Description, expectedStatusDescription); - Assert.AreEqual(response.Messages[0].Status.GroupId, expectedStatusGroupId); + Assert.AreEqual(expectedMessageCount, response.Messages.Count); + Assert.AreEqual(expectedMessageId, response.Messages[0].MessageId); + Assert.AreEqual(expectedTo, response.Messages[0].To); + Assert.AreEqual(expectedStatusId, response.Messages[0].Status.Id); + Assert.AreEqual(expectedStatusName, response.Messages[0].Status.Name); + Assert.AreEqual(expectedStatusGroupId, response.Messages[0].Status.GroupId); + Assert.AreEqual(expectedStatusDescription, response.Messages[0].Status.Description); + Assert.AreEqual(expectedStatusGroupId, response.Messages[0].Status.GroupId); } [TestMethod] @@ -320,28 +320,28 @@ public void ShouldGetEmailDeliveryReportsTest() EmailReportsResult response = sendEmailApi.GetEmailDeliveryReports(bulkId: expectedBulkId, messageId: expectedMessageId, limit: 2); - Assert.AreEqual(response.Results.Count, 1); - Assert.AreEqual(response.Results[0].BulkId, expectedBulkId); - Assert.AreEqual(response.Results[0].MessageId, expectedMessageId); + Assert.AreEqual(1, response.Results.Count); + Assert.AreEqual(expectedBulkId, response.Results[0].BulkId); + Assert.AreEqual(expectedMessageId, response.Results[0].MessageId); - Assert.AreEqual(response.Results[0].SentAt, expectedSentAt); - Assert.AreEqual(response.Results[0].DoneAt, expectedDoneAt); - Assert.AreEqual(response.Results[0].MessageCount, expectedMessageCount); + Assert.AreEqual(expectedSentAt, response.Results[0].SentAt); + Assert.AreEqual(expectedDoneAt, response.Results[0].DoneAt); + Assert.AreEqual(expectedMessageCount, response.Results[0].MessageCount); - Assert.AreEqual(response.Results[0].Status.Description, expectedStatusDescription); - Assert.AreEqual(response.Results[0].Status.GroupId, expectedStatusGroupId); - Assert.AreEqual(response.Results[0].Status.GroupName, expectedStatusGroupName); - Assert.AreEqual(response.Results[0].Status.Id, expectedStatusId); - Assert.AreEqual(response.Results[0].Status.Name, expectedStatusName); + Assert.AreEqual(expectedStatusDescription, response.Results[0].Status.Description); + Assert.AreEqual(expectedStatusGroupId, response.Results[0].Status.GroupId); + Assert.AreEqual(expectedStatusGroupName, response.Results[0].Status.GroupName); + Assert.AreEqual(expectedStatusId, response.Results[0].Status.Id); + Assert.AreEqual(expectedStatusName, response.Results[0].Status.Name); - Assert.AreEqual(response.Results[0].Price.PricePerMessage, expectedPricePerMessage); + Assert.AreEqual(expectedPricePerMessage, response.Results[0].Price.PricePerMessage); - Assert.AreEqual(response.Results[0].Error.Description, expectedErrorDescription); - Assert.AreEqual(response.Results[0].Error.GroupId, expectedErrorGroupId); - Assert.AreEqual(response.Results[0].Error.GroupName, expectedErrorGroupName); - Assert.AreEqual(response.Results[0].Error.Id, expectedErrorId); - Assert.AreEqual(response.Results[0].Error.Name, expectedErrorName); - Assert.AreEqual(response.Results[0].Error.Permanent, expectedErrorPermanent); + Assert.AreEqual(expectedErrorDescription, response.Results[0].Error.Description); + Assert.AreEqual(expectedErrorGroupId, response.Results[0].Error.GroupId); + Assert.AreEqual(expectedErrorGroupName, response.Results[0].Error.GroupName); + Assert.AreEqual(expectedErrorId, response.Results[0].Error.Id); + Assert.AreEqual(expectedErrorName, response.Results[0].Error.Name); + Assert.AreEqual(expectedErrorPermanent, response.Results[0].Error.Permanent); } [TestMethod] @@ -402,24 +402,24 @@ public void ShouldGetEmailLogsTest() limit: 2 ); - Assert.AreEqual(response.Results.Count, 1); + Assert.AreEqual(1, response.Results.Count); - Assert.AreEqual(response.Results[0].From, expectedFrom); - Assert.AreEqual(response.Results[0].BulkId, expectedBulkId); - Assert.AreEqual(response.Results[0].MessageId, expectedMessageId); - Assert.AreEqual(response.Results[0].SentAt, expectedSentAt); - Assert.AreEqual(response.Results[0].DoneAt, expectedDoneAt); - Assert.AreEqual(response.Results[0].Text, expectedText); - Assert.AreEqual(response.Results[0].To, expectedTo); - Assert.AreEqual(response.Results[0].MessageCount, expectedMessageCount); + Assert.AreEqual(expectedFrom, response.Results[0].From); + Assert.AreEqual(expectedBulkId, response.Results[0].BulkId); + Assert.AreEqual(expectedMessageId, response.Results[0].MessageId); + Assert.AreEqual(expectedSentAt, response.Results[0].SentAt); + Assert.AreEqual(expectedDoneAt, response.Results[0].DoneAt); + Assert.AreEqual(expectedText, response.Results[0].Text); + Assert.AreEqual(expectedTo, response.Results[0].To); + Assert.AreEqual(expectedMessageCount, response.Results[0].MessageCount); - Assert.AreEqual(response.Results[0].Status.Description, expectedStatusDescription); - Assert.AreEqual(response.Results[0].Status.GroupId, expectedStatusGroupId); - Assert.AreEqual(response.Results[0].Status.GroupName, expectedStatusGroupName); - Assert.AreEqual(response.Results[0].Status.Id, expectedStatusId); - Assert.AreEqual(response.Results[0].Status.Name, expectedStatusName); + Assert.AreEqual(expectedStatusDescription, response.Results[0].Status.Description); + Assert.AreEqual(expectedStatusGroupId, response.Results[0].Status.GroupId); + Assert.AreEqual(expectedStatusGroupName, response.Results[0].Status.GroupName); + Assert.AreEqual(expectedStatusId, response.Results[0].Status.Id); + Assert.AreEqual(expectedStatusName, response.Results[0].Status.Name); - Assert.AreEqual(response.Results[0].Price.PricePerMessage, expectedPricePerMessage); + Assert.AreEqual(expectedPricePerMessage, response.Results[0].Price.PricePerMessage); } [TestMethod] @@ -446,11 +446,11 @@ public void ShouldGetScheduledEmailsTest() EmailBulkScheduleResponse response = scheduledEmailApi.GetScheduledEmails(expectedBulkId); - Assert.AreEqual(response.Bulks.Count, 1); - Assert.AreEqual(response.ExternalBulkId, expectedExternalBulkId); + Assert.AreEqual(1, response.Bulks.Count); + Assert.AreEqual(expectedExternalBulkId, response.ExternalBulkId); - Assert.AreEqual(response.Bulks[0].BulkId, expectedBulkId); - Assert.AreEqual(response.Bulks[0].SendAt, expectedSentAt); + Assert.AreEqual(expectedBulkId, response.Bulks[0].BulkId); + Assert.AreEqual(expectedSentAt, response.Bulks[0].SendAt); } [TestMethod] @@ -477,8 +477,8 @@ public void ShouldRescheduleEmailsTest() EmailBulkRescheduleResponse response = scheduledEmailApi.RescheduleEmails(expectedBulkId, rescheduleRequest); - Assert.AreEqual(response.BulkId, expectedBulkId); - Assert.AreEqual(response.SendAt, expectedSentAt); + Assert.AreEqual(expectedBulkId, response.BulkId); + Assert.AreEqual(expectedSentAt, response.SendAt); } [TestMethod] @@ -512,12 +512,12 @@ public void ShouldGetScheduledEmailStatusTest() EmailBulkStatusResponse response = scheduledEmailApi.GetScheduledEmailStatuses(expectedBulkId); - Assert.AreEqual(response.Bulks.Count, 2); - Assert.AreEqual(response.ExternalBulkId, expectedExternalBulkId); - Assert.AreEqual(response.Bulks[0].BulkId, expectedBulkId); - Assert.AreEqual(response.Bulks[0].Status, expectedStatus); - Assert.AreEqual(response.Bulks[1].BulkId, expectedBulkId2); - Assert.AreEqual(response.Bulks[1].Status, expectedStatus2); + Assert.AreEqual(2, response.Bulks.Count); + Assert.AreEqual(expectedExternalBulkId, response.ExternalBulkId); + Assert.AreEqual(expectedBulkId, response.Bulks[0].BulkId); + Assert.AreEqual(expectedStatus, response.Bulks[0].Status); + Assert.AreEqual(expectedBulkId2, response.Bulks[1].BulkId); + Assert.AreEqual(expectedStatus2, response.Bulks[1].Status); } [TestMethod] @@ -545,8 +545,8 @@ public void ShouldUpdateEmailStatusTest() EmailBulkUpdateStatusResponse response = scheduledEmailApi.UpdateScheduledEmailStatuses(expectedBulkId, updateStatusRequest); - Assert.AreEqual(response.BulkId, expectedBulkId); - Assert.AreEqual(response.Status, expectedStatus); + Assert.AreEqual(expectedBulkId, response.BulkId); + Assert.AreEqual(expectedStatus, response.Status); } [TestMethod] @@ -584,13 +584,14 @@ public void ValidateEmailAddressesTest() EmailValidationResponse response = emailValidationApi.ValidateEmailAddresses(validationRequest); - Assert.AreEqual(response.To, expectedTo); - Assert.AreEqual(response.CatchAll, expectedCatchAll); - Assert.AreEqual(response.DidYouMean, expectedDidYouMean); - Assert.AreEqual(response.Disposable, expectedDisposable); - Assert.AreEqual(response.RoleBased, expectedRoleBased); - Assert.AreEqual(response.ValidMailbox, expectedValidMailbox); - Assert.AreEqual(response.ValidSyntax, expectedValidSyntax); + Assert.IsNotNull(response); + Assert.AreEqual(expectedTo, response.To); + Assert.AreEqual(expectedCatchAll, response.CatchAll); + Assert.AreEqual(expectedDidYouMean, response.DidYouMean); + Assert.AreEqual(expectedDisposable, response.Disposable); + Assert.AreEqual(expectedRoleBased, response.RoleBased); + Assert.AreEqual(expectedValidMailbox, response.ValidMailbox); + Assert.AreEqual(expectedValidSyntax, response.ValidSyntax); } [TestMethod] @@ -659,25 +660,25 @@ public void ShouldGetAllDomainsForTheAccount() void AssertEmailAllDomainsResponse(EmailAllDomainsResponse emailAllDomainsResponse) { Assert.IsNotNull(emailAllDomainsResponse.Paging); - Assert.AreEqual(emailAllDomainsResponse.Paging.Page, expectedPage); - Assert.AreEqual(emailAllDomainsResponse.Paging.Size, expectedSize); - Assert.AreEqual(emailAllDomainsResponse.Paging.TotalPages, expectedTotalPages); - Assert.AreEqual(emailAllDomainsResponse.Paging.TotalResults, expectedTotalResults); + Assert.AreEqual(expectedPage, emailAllDomainsResponse.Paging.Page); + Assert.AreEqual(expectedSize, emailAllDomainsResponse.Paging.Size); + Assert.AreEqual(expectedTotalPages, emailAllDomainsResponse.Paging.TotalPages); + Assert.AreEqual(expectedTotalResults, emailAllDomainsResponse.Paging.TotalResults); Assert.IsNotNull(emailAllDomainsResponse.Results); - Assert.AreEqual(emailAllDomainsResponse.Results[0].DomainId, expectedDomainId); - Assert.AreEqual(emailAllDomainsResponse.Results[0].DomainName, expectedDomainName); - Assert.AreEqual(emailAllDomainsResponse.Results[0].Active, expectedActive); - Assert.AreEqual(emailAllDomainsResponse.Results[0].Tracking.Clicks, expectedClicks); - Assert.AreEqual(emailAllDomainsResponse.Results[0].Tracking.Opens, expectedOpens); - Assert.AreEqual(emailAllDomainsResponse.Results[0].Tracking.Unsubscribe, expectedUnsubscribe); - Assert.AreEqual(emailAllDomainsResponse.Results[0].DnsRecords[0].RecordType, expectedRecordType); - Assert.AreEqual(emailAllDomainsResponse.Results[0].DnsRecords[0].Name, expectedName); - Assert.AreEqual(emailAllDomainsResponse.Results[0].DnsRecords[0].ExpectedValue, expectedExpectedValue); - Assert.AreEqual(emailAllDomainsResponse.Results[0].DnsRecords[0].Verified, expectedVerified); - Assert.AreEqual(emailAllDomainsResponse.Results[0].Blocked, expectedBlocked); - Assert.AreEqual(emailAllDomainsResponse.Results[0].CreatedAt, expectedCreatedAt); - Assert.AreEqual(emailAllDomainsResponse.Results[0].ReturnPathAddress, expectedReturnPathAddress); + Assert.AreEqual(expectedDomainId, emailAllDomainsResponse.Results[0].DomainId); + Assert.AreEqual(expectedDomainName, emailAllDomainsResponse.Results[0].DomainName); + Assert.AreEqual(expectedActive, emailAllDomainsResponse.Results[0].Active); + Assert.AreEqual(expectedClicks, emailAllDomainsResponse.Results[0].Tracking.Clicks); + Assert.AreEqual(expectedOpens, emailAllDomainsResponse.Results[0].Tracking.Opens); + Assert.AreEqual(expectedUnsubscribe, emailAllDomainsResponse.Results[0].Tracking.Unsubscribe); + Assert.AreEqual(expectedRecordType, emailAllDomainsResponse.Results[0].DnsRecords[0].RecordType); + Assert.AreEqual(expectedName, emailAllDomainsResponse.Results[0].DnsRecords[0].Name); + Assert.AreEqual(expectedExpectedValue, emailAllDomainsResponse.Results[0].DnsRecords[0].ExpectedValue); + Assert.AreEqual(expectedVerified, emailAllDomainsResponse.Results[0].DnsRecords[0].Verified); + Assert.AreEqual(expectedBlocked, emailAllDomainsResponse.Results[0].Blocked); + Assert.AreEqual(expectedCreatedAt, emailAllDomainsResponse.Results[0].CreatedAt); + Assert.AreEqual(expectedReturnPathAddress, emailAllDomainsResponse.Results[0].ReturnPathAddress); } AssertResponse(emailApi.GetAllDomains(expectedSize, expectedPage), AssertEmailAllDomainsResponse); @@ -758,19 +759,19 @@ public void ShouldAddNewDomain() void AssertEmailDomainResponse(EmailDomainResponse emailDomainResponse) { Assert.IsNotNull(emailDomainResponse); - Assert.AreEqual(emailDomainResponse.DomainId, expectedDomainId); - Assert.AreEqual(emailDomainResponse.DomainName, expectedDomainName); - Assert.AreEqual(emailDomainResponse.Active, expectedActive); - Assert.AreEqual(emailDomainResponse.Tracking.Clicks, expectedClicks); - Assert.AreEqual(emailDomainResponse.Tracking.Opens, expectedOpens); - Assert.AreEqual(emailDomainResponse.Tracking.Unsubscribe, expectedUnsubscribe); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].RecordType, expectedRecordType); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Name, expectedName); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].ExpectedValue, expectedExpectedValue); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Verified, expectedVerified); - Assert.AreEqual(emailDomainResponse.Blocked, expectedBlocked); - Assert.AreEqual(emailDomainResponse.CreatedAt, expectedCreatedAt); - Assert.AreEqual(emailDomainResponse.ReturnPathAddress, expectedReturnPathAddress); + Assert.AreEqual(expectedDomainId, emailDomainResponse.DomainId); + Assert.AreEqual(expectedDomainName, emailDomainResponse.DomainName); + Assert.AreEqual(expectedActive, emailDomainResponse.Active); + Assert.AreEqual(expectedClicks, emailDomainResponse.Tracking.Clicks); + Assert.AreEqual(expectedOpens, emailDomainResponse.Tracking.Opens); + Assert.AreEqual(expectedUnsubscribe, emailDomainResponse.Tracking.Unsubscribe); + Assert.AreEqual(expectedRecordType, emailDomainResponse.DnsRecords[0].RecordType); + Assert.AreEqual(expectedName, emailDomainResponse.DnsRecords[0].Name); + Assert.AreEqual(expectedExpectedValue, emailDomainResponse.DnsRecords[0].ExpectedValue); + Assert.AreEqual(expectedVerified, emailDomainResponse.DnsRecords[0].Verified); + Assert.AreEqual(expectedBlocked, emailDomainResponse.Blocked); + Assert.AreEqual(expectedCreatedAt, emailDomainResponse.CreatedAt); + Assert.AreEqual(expectedReturnPathAddress, emailDomainResponse.ReturnPathAddress); } AssertResponse(emailApi.AddDomain(emailAddDomainRequest), AssertEmailDomainResponse); @@ -827,19 +828,19 @@ public void ShouldGetDomainDetails() void AssertEmailDomainResponse(EmailDomainResponse emailDomainResponse) { Assert.IsNotNull(emailDomainResponse); - Assert.AreEqual(emailDomainResponse.DomainId, expectedDomainId); - Assert.AreEqual(emailDomainResponse.DomainName, expectedDomainName); - Assert.AreEqual(emailDomainResponse.Active, expectedActive); - Assert.AreEqual(emailDomainResponse.Tracking.Clicks, expectedClicks); - Assert.AreEqual(emailDomainResponse.Tracking.Opens, expectedOpens); - Assert.AreEqual(emailDomainResponse.Tracking.Unsubscribe, expectedUnsubscribe); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].RecordType, expectedRecordType); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Name, expectedName); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].ExpectedValue, expectedExpectedValue); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Verified, expectedVerified); - Assert.AreEqual(emailDomainResponse.Blocked, expectedBlocked); - Assert.AreEqual(emailDomainResponse.CreatedAt, expectedCreatedAt); - Assert.AreEqual(emailDomainResponse.ReturnPathAddress, expectedReturnPathAddress); + Assert.AreEqual(expectedDomainId, emailDomainResponse.DomainId); + Assert.AreEqual(expectedDomainName, emailDomainResponse.DomainName); + Assert.AreEqual(expectedActive, emailDomainResponse.Active); + Assert.AreEqual(expectedClicks, emailDomainResponse.Tracking.Clicks); + Assert.AreEqual(expectedOpens, emailDomainResponse.Tracking.Opens); + Assert.AreEqual(expectedUnsubscribe, emailDomainResponse.Tracking.Unsubscribe); + Assert.AreEqual(expectedRecordType, emailDomainResponse.DnsRecords[0].RecordType); + Assert.AreEqual(expectedName, emailDomainResponse.DnsRecords[0].Name); + Assert.AreEqual(expectedExpectedValue, emailDomainResponse.DnsRecords[0].ExpectedValue); + Assert.AreEqual(expectedVerified, emailDomainResponse.DnsRecords[0].Verified); + Assert.AreEqual(expectedBlocked, emailDomainResponse.Blocked); + Assert.AreEqual(expectedCreatedAt, emailDomainResponse.CreatedAt); + Assert.AreEqual(expectedReturnPathAddress, emailDomainResponse.ReturnPathAddress); } AssertResponse(emailApi.GetDomainDetails(expectedDomainName), AssertEmailDomainResponse); @@ -922,19 +923,19 @@ public void ShouldUpdateTrackingEvents() void AssertEmailDomainResponse(EmailDomainResponse emailDomainResponse) { Assert.IsNotNull(emailDomainResponse); - Assert.AreEqual(emailDomainResponse.DomainId, expectedDomainId); - Assert.AreEqual(emailDomainResponse.DomainName, expectedDomainName); - Assert.AreEqual(emailDomainResponse.Active, expectedActive); - Assert.AreEqual(emailDomainResponse.Tracking.Clicks, expectedClicks); - Assert.AreEqual(emailDomainResponse.Tracking.Opens, expectedOpens); - Assert.AreEqual(emailDomainResponse.Tracking.Unsubscribe, expectedUnsubscribe); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].RecordType, expectedRecordType); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Name, expectedName); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].ExpectedValue, expectedExpectedValue); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Verified, expectedVerified); - Assert.AreEqual(emailDomainResponse.Blocked, expectedBlocked); - Assert.AreEqual(emailDomainResponse.CreatedAt, expectedCreatedAt); - Assert.AreEqual(emailDomainResponse.ReturnPathAddress, expectedReturnPathAddress); + Assert.AreEqual(expectedDomainId, emailDomainResponse.DomainId); + Assert.AreEqual(expectedDomainName, emailDomainResponse.DomainName); + Assert.AreEqual(expectedActive, emailDomainResponse.Active); + Assert.AreEqual(expectedClicks, emailDomainResponse.Tracking.Clicks); + Assert.AreEqual(expectedOpens, emailDomainResponse.Tracking.Opens); + Assert.AreEqual(expectedUnsubscribe, emailDomainResponse.Tracking.Unsubscribe); + Assert.AreEqual(expectedRecordType, emailDomainResponse.DnsRecords[0].RecordType); + Assert.AreEqual(expectedName, emailDomainResponse.DnsRecords[0].Name); + Assert.AreEqual(expectedExpectedValue, emailDomainResponse.DnsRecords[0].ExpectedValue); + Assert.AreEqual(expectedVerified, emailDomainResponse.DnsRecords[0].Verified); + Assert.AreEqual(expectedBlocked, emailDomainResponse.Blocked); + Assert.AreEqual(expectedCreatedAt, emailDomainResponse.CreatedAt); + Assert.AreEqual(expectedReturnPathAddress, emailDomainResponse.ReturnPathAddress); } AssertResponse(emailApi.UpdateTrackingEvents(expectedDomainName, emailTrackingEventRequest), AssertEmailDomainResponse); @@ -1000,19 +1001,19 @@ public void ShouldUpdateReturnPath() void AssertEmailDomainResponse(EmailDomainResponse emailDomainResponse) { Assert.IsNotNull(emailDomainResponse); - Assert.AreEqual(emailDomainResponse.DomainId, expectedDomainId); - Assert.AreEqual(emailDomainResponse.DomainName, expectedDomainName); - Assert.AreEqual(emailDomainResponse.Active, expectedActive); - Assert.AreEqual(emailDomainResponse.Tracking.Clicks, expectedClicks); - Assert.AreEqual(emailDomainResponse.Tracking.Opens, expectedOpens); - Assert.AreEqual(emailDomainResponse.Tracking.Unsubscribe, expectedUnsubscribe); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].RecordType, expectedRecordType); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Name, expectedName); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].ExpectedValue, expectedExpectedValue); - Assert.AreEqual(emailDomainResponse.DnsRecords[0].Verified, expectedVerified); - Assert.AreEqual(emailDomainResponse.Blocked, expectedBlocked); - Assert.AreEqual(emailDomainResponse.CreatedAt, expectedCreatedAt); - Assert.AreEqual(emailDomainResponse.ReturnPathAddress, expectedReturnPathAddress); + Assert.AreEqual(expectedDomainId, emailDomainResponse.DomainId); + Assert.AreEqual(expectedDomainName, emailDomainResponse.DomainName); + Assert.AreEqual(expectedActive, emailDomainResponse.Active); + Assert.AreEqual(expectedClicks, emailDomainResponse.Tracking.Clicks); + Assert.AreEqual(expectedOpens, emailDomainResponse.Tracking.Opens); + Assert.AreEqual(expectedUnsubscribe, emailDomainResponse.Tracking.Unsubscribe); + Assert.AreEqual(expectedRecordType, emailDomainResponse.DnsRecords[0].RecordType); + Assert.AreEqual(expectedName, emailDomainResponse.DnsRecords[0].Name); + Assert.AreEqual(expectedExpectedValue, emailDomainResponse.DnsRecords[0].ExpectedValue); + Assert.AreEqual(expectedVerified, emailDomainResponse.DnsRecords[0].Verified); + Assert.AreEqual(expectedBlocked, emailDomainResponse.Blocked); + Assert.AreEqual(expectedCreatedAt, emailDomainResponse.CreatedAt); + Assert.AreEqual(expectedReturnPathAddress, emailDomainResponse.ReturnPathAddress); } AssertResponse(emailApi.UpdateReturnPath(expectedDomainName, emailReturnPathAddressRequest), AssertEmailDomainResponse); @@ -1063,10 +1064,10 @@ void AssertEmailDomainIpResponse(EmailDomainIpResponse emailDomainIpResponse) { Assert.IsNotNull(emailDomainIpResponse); Assert.IsNotNull(emailDomainIpResponse.Result[0]); - Assert.AreEqual(emailDomainIpResponse.Result[0].IpAddress, expectedIpAddress); - Assert.AreEqual(emailDomainIpResponse.Result[0].Dedicated, expectedDedicated); - Assert.AreEqual(emailDomainIpResponse.Result[0].AssignedDomainCount, expectedAssignedDomainCount); - Assert.AreEqual(emailDomainIpResponse.Result[0].Status, expectedStatus); + Assert.AreEqual(expectedIpAddress, emailDomainIpResponse.Result[0].IpAddress); + Assert.AreEqual(expectedDedicated, emailDomainIpResponse.Result[0].Dedicated); + Assert.AreEqual(expectedAssignedDomainCount, emailDomainIpResponse.Result[0].AssignedDomainCount); + Assert.AreEqual(expectedStatus, emailDomainIpResponse.Result[0].Status); } AssertResponse(emailApi.GetAllIps(), AssertEmailDomainIpResponse); @@ -1111,10 +1112,10 @@ void AssertEmailDomainIpResponse(EmailDomainIpResponse emailDomainIpResponse) { Assert.IsNotNull(emailDomainIpResponse); Assert.IsNotNull(emailDomainIpResponse.Result[0]); - Assert.AreEqual(emailDomainIpResponse.Result[0].IpAddress, expectedIpAddress); - Assert.AreEqual(emailDomainIpResponse.Result[0].Dedicated, expectedDedicated); - Assert.AreEqual(emailDomainIpResponse.Result[0].AssignedDomainCount, expectedAssignedDomainCount); - Assert.AreEqual(emailDomainIpResponse.Result[0].Status, expectedStatus); + Assert.AreEqual(expectedIpAddress, emailDomainIpResponse.Result[0].IpAddress); + Assert.AreEqual(expectedDedicated, emailDomainIpResponse.Result[0].Dedicated); + Assert.AreEqual(expectedAssignedDomainCount, emailDomainIpResponse.Result[0].AssignedDomainCount); + Assert.AreEqual(expectedStatus, emailDomainIpResponse.Result[0].Status); } AssertResponse(emailApi.GetAllDomainIps(expectedDomainName), AssertEmailDomainIpResponse); @@ -1155,7 +1156,7 @@ public void ShouldAssignDedicatedIpAddressToProvidedDomainForTheAccountId() void AssertEmailSimpleApiResponse(EmailSimpleApiResponse emailSimpleApiResponse) { Assert.IsNotNull(emailSimpleApiResponse); - Assert.AreEqual(emailSimpleApiResponse.Result, expectedResult); + Assert.AreEqual(expectedResult, emailSimpleApiResponse.Result); } AssertResponse(emailApi.AssignIpToDomain(emailDomainIpRequest), AssertEmailSimpleApiResponse); @@ -1191,7 +1192,7 @@ public void ShouldRemoveDedicatedIpAddressFromTheProvidedDomain() void AssertEmailSimpleApiResponse(EmailSimpleApiResponse emailSimpleApiResponse) { Assert.IsNotNull(emailSimpleApiResponse); - Assert.AreEqual(emailSimpleApiResponse.Result, expectedResult); + Assert.AreEqual(expectedResult, emailSimpleApiResponse.Result); } AssertResponse(emailApi.RemoveIpFromDomain(givenDomainName, givenIpAddress), AssertEmailSimpleApiResponse); diff --git a/ApiClient.Tests/Api/TfaApiTest.cs b/ApiClient.Tests/Api/TfaApiTest.cs index 9cdbbe6..b9973c2 100644 --- a/ApiClient.Tests/Api/TfaApiTest.cs +++ b/ApiClient.Tests/Api/TfaApiTest.cs @@ -657,12 +657,12 @@ public void ShouldCreateTfaEmailMessageTemplateTest() void AssertTfaCreateEmailMessageResponse(TfaEmailMessage tfaEmailMessage) { Assert.IsNotNull(tfaEmailMessage); - Assert.AreEqual(tfaEmailMessage.MessageId, expectedMessageId); - Assert.AreEqual(tfaEmailMessage.ApplicationId, expectedApplicationId); - Assert.AreEqual(tfaEmailMessage.PinLength, expectedPinLength); - Assert.AreEqual(tfaEmailMessage.PinType, expectedPinType); - Assert.AreEqual(tfaEmailMessage.From, expectedFrom); - Assert.AreEqual(tfaEmailMessage.EmailTemplateId, expectedEmailTemplateId); + Assert.AreEqual(expectedMessageId, tfaEmailMessage.MessageId); + Assert.AreEqual(expectedApplicationId, tfaEmailMessage.ApplicationId); + Assert.AreEqual(expectedPinLength, tfaEmailMessage.PinLength); + Assert.AreEqual(expectedPinType, tfaEmailMessage.PinType); + Assert.AreEqual(expectedFrom, tfaEmailMessage.From); + Assert.AreEqual(expectedEmailTemplateId, tfaEmailMessage.EmailTemplateId); } AssertResponse(tfaApi.CreateTfaEmailMessageTemplate(expectedApplicationId, tfaCreateEmailMessageRequest), AssertTfaCreateEmailMessageResponse); @@ -715,12 +715,12 @@ public void ShouldUpdateTfaEmailMessageTemplateTest() void AssertTfaUpdateEmailMessageResponse(TfaEmailMessage tfaEmailMessage) { Assert.IsNotNull(tfaEmailMessage); - Assert.AreEqual(tfaEmailMessage.MessageId, expectedMessageId); - Assert.AreEqual(tfaEmailMessage.ApplicationId, expectedApplicationId); - Assert.AreEqual(tfaEmailMessage.PinLength, expectedPinLength); - Assert.AreEqual(tfaEmailMessage.PinType, expectedPinType); - Assert.AreEqual(tfaEmailMessage.From, expectedFrom); - Assert.AreEqual(tfaEmailMessage.EmailTemplateId, expectedEmailTemplateId); + Assert.AreEqual(expectedMessageId, tfaEmailMessage.MessageId); + Assert.AreEqual(expectedApplicationId, tfaEmailMessage.ApplicationId); + Assert.AreEqual(expectedPinLength, tfaEmailMessage.PinLength); + Assert.AreEqual(expectedPinType, tfaEmailMessage.PinType); + Assert.AreEqual(expectedFrom, tfaEmailMessage.From); + Assert.AreEqual(expectedEmailTemplateId, tfaEmailMessage.EmailTemplateId); } AssertResponse(tfaApi.UpdateTfaEmailMessageTemplate(expectedApplicationId, expectedMessageId, tfaUpdateEmailMessageRequest), AssertTfaUpdateEmailMessageResponse);