Example #1
0
        public void TestFetchFileBodiesHelper(Web webApi)
        {
            // Test using credentials
            var message = new Mock<ISendGrid>();
            var attachments = new[] {"foo", "bar", "foobar"};
            message.SetupProperty(foo => foo.Attachments, null);
            var result = webApi.FetchFileBodies(message.Object);
            Assert.AreEqual(0, result.Count);

            message.SetupProperty(foo => foo.Attachments, attachments);
            result = webApi.FetchFileBodies(message.Object);
            Assert.AreEqual(attachments.Count(), result.Count);
            for (var index = 0; index < attachments.Length; index++)
                Assert.AreEqual(result[index].Value.Name, attachments[index]);
        }
Example #2
0
        public void TestFetchFileBodies()
        {
            var webApi = new Web(new NetworkCredential(TestUsername, TestPassword));
            var message = new Mock<ISendGrid>();
            var attachments = new[] {"foo", "bar", "foobar"};
            message.SetupProperty(foo => foo.Attachments, null);
            var result = webApi.FetchFileBodies(message.Object);
            Assert.AreEqual(0, result.Count);

            message.SetupProperty(foo => foo.Attachments, attachments);
            result = webApi.FetchFileBodies(message.Object);
            Assert.AreEqual(attachments.Count(), result.Count);
            for (var index = 0; index < attachments.Length; index++)
                Assert.AreEqual(result[index].Value.Name, attachments[index]);
        }