public void TestDeleteOneAttachment() { Payment payment = createValidPayment(); List <string> expectedAttachments = new List <string>(); expectedAttachments.Add(@"C:\ConnectString.txt"); expectedAttachments.Add(@"C:\Windows\notepad.exe"); expectedAttachments.Add(@"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"); foreach (string attachment in expectedAttachments) { payment.AddAttachment(attachment); } payment.DeleteAttachment(@"C:\ConnectString.txt"); expectedAttachments.Remove(@"C:\ConnectString.txt"); List <string> actualAttachments = new List <string>(); foreach (string attachment in payment.Attachments) { actualAttachments.Add(attachment); } CollectionAssert.AreEqual(expectedAttachments, actualAttachments); }
public void TestAttachmentOneValidString() { Payment payment = createValidPayment(); string expectedAttachment = @"C:\ConnectString.txt"; payment.AddAttachment(expectedAttachment); string actualAttachment = payment.Attachments[0]; Assert.AreEqual(expectedAttachment, actualAttachment); }
public void TestAttachmentNull() { Payment payment = createValidPayment(); bool caughtException = false; try { payment.AddAttachment(null); } catch (ArgumentOutOfRangeException) { caughtException = true; } Assert.AreEqual(true, caughtException); }
public void TestAttachmentNonexistingFile() { Payment payment = createValidPayment(); bool caughtException = false; try { payment.AddAttachment("nonexcistingfile"); } catch (ArgumentOutOfRangeException) { caughtException = true; } Assert.AreEqual(true, caughtException); }