Exemplo n.º 1
0
        public void TestParseMessageError2()
        {
            ServiceLocator.Current.Log = new MockLog();

            MockEmailHeader header = new MockEmailHeader(
                @"""Weston Thayer (SMS)"" <*****@*****.**>", // unknown email
                @"*****@*****.**",
                null,
                null,
                @"SMS from Weston Thayer [(444) 555-8888]"
                );

            MockEmail email = new MockEmail(header, null, "test");

            AssertExtensions.Throws(typeof(ArgumentException), () => GvEmailParser.ParseMessage(email));

            header = new MockEmailHeader(
                @"""Weston Thayer (SMS)"" <*****@*****.**>",
                @"", // can't be empty
                null,
                null,
                @"SMS from Weston Thayer [(444) 555-8888]"
                );

            email = new MockEmail(header, null, "test");

            AssertExtensions.Throws(typeof(ArgumentException), () => GvEmailParser.ParseMessage(email));

            header = new MockEmailHeader(
                @"Google Voice <*****@*****.**>",
                @"*****@*****.**",
                null,
                null,
                @"" // can't be empty, but only used with above From header
                );

            email = new MockEmail(header, null, "test");

            AssertExtensions.Throws(typeof(ArgumentException), () => GvEmailParser.ParseMessage(email));
        }
Exemplo n.º 2
0
        public void TestParseMessageError1()
        {
            ServiceLocator.Current.Log = new MockLog();

            MockEmailHeader header = new MockEmailHeader(
                @"""Weston Thayer (SMS)"" <*****@*****.**>",
                @"*****@*****.**",
                null,
                null,
                @"SMS from Weston Thayer [(444) 555-8888]"
                );

            MockEmail email = new MockEmail(header, null, "test");

            Message result = GvEmailParser.ParseMessage(email);

            Assert.AreEqual("test", result.Body);
            Assert.AreEqual("+14445558888", result.Number);
            Assert.AreEqual("Weston Thayer", result.Sender);
            Assert.AreEqual(null, result.ThreadId);
            Assert.AreEqual("SMS", result.Type);
            Assert.AreEqual("*****@*****.**", result.UserEmail);
        }
Exemplo n.º 3
0
 public MockEmail(MockEmailHeader header, string data, string rawBody)
 {
     this.header = header;
     this.data = data;
     this.rawBody = rawBody;
 }