Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 3
0
        public void TestAttachmentNull()
        {
            Payment payment         = createValidPayment();
            bool    caughtException = false;

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

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

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

            Assert.AreEqual(true, caughtException);
        }