Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void TestAttachmentOneValidString()
        {
            Payment payment            = createValidPayment();
            string  expectedAttachment = @"C:\ConnectString.txt";

            payment.AddAttachment(expectedAttachment);

            string actualAttachment = payment.Attachments[0];

            Assert.AreEqual(expectedAttachment, actualAttachment);
        }
Esempio n. 3
0
        public void TestAttachmentNull()
        {
            Payment payment         = createValidPayment();
            bool    caughtException = false;

            try
            {
                payment.AddAttachment(null);
            }
            catch (ArgumentOutOfRangeException)
            {
                caughtException = true;
            }

            Assert.AreEqual(true, caughtException);
        }
Esempio n. 4
0
        public void TestAttachmentNonexistingFile()
        {
            Payment payment         = createValidPayment();
            bool    caughtException = false;

            try
            {
                payment.AddAttachment("nonexcistingfile");
            }
            catch (ArgumentOutOfRangeException)
            {
                caughtException = true;
            }

            Assert.AreEqual(true, caughtException);
        }