Example #1
0
        public void TestResetProperties()
        {
            using (ShimsContext.Create())
            {
                var server      = new ShimSMTPServer();
                var settings    = new StubIReceiveSettings();
                var transaction = new SMTPTransaction(server, settings);

                transaction.SetProperty("foo", "bar", false);
                transaction.SetProperty("foo2", "baz", true);
                Assert.True(transaction.HasProperty("foo"));
                Assert.Equal("bar", transaction.GetProperty <string>("foo"));
                Assert.True(transaction.HasProperty("foo2"));
                Assert.Equal("baz", transaction.GetProperty <string>("foo2"));

                transaction.Reset();
                Assert.False(transaction.HasProperty("foo"));
                Assert.Equal(default(string), transaction.GetProperty <string>("foo"));
                Assert.True(transaction.HasProperty("foo2"));
                Assert.Equal("baz", transaction.GetProperty <string>("foo2"));
            }
        }
Example #2
0
        public void TestHasProperty()
        {
            using (ShimsContext.Create())
            {
                var server      = new ShimSMTPServer();
                var settings    = new StubIReceiveSettings();
                var transaction = new SMTPTransaction(server, settings);

                Assert.False(transaction.HasProperty("foo"));

                transaction.SetProperty("foo", 5, false);
                Assert.True(transaction.HasProperty("foo"));

                transaction.SetProperty("foo", null, false);
                Assert.False(transaction.HasProperty("foo"));

                transaction.SetProperty("foo", 5, true);
                Assert.True(transaction.HasProperty("foo"));

                transaction.SetProperty("foo", null, true);
                Assert.False(transaction.HasProperty("foo"));
            }
        }
Example #3
0
        public bool ProcessResponse(SMTPTransaction transaction, string response, out string challenge)
        {
            if (response == null)
            {
                challenge = "Username:"******"Username"))
            {
                transaction.SetProperty("Username", response, true);
                challenge = "Password:"******"Password", response, true);
            challenge = null;

            // TODO
            // var password = response;
            // var username = transaction.GetProperty<string>("Username");

            return(true);
        }