Exemplo n.º 1
0
        public void TestSetAndGetProperty()
        {
            var core = new SMTPServer(DefaultLoader());

            const int    value1 = 5;
            const string value2 = "foo";
            const bool   value3 = false;
            var          value4 = new object();

            core.SetProperty("foo", value1);
            var actualValue1 = core.GetProperty <int>("foo");

            Assert.Equal(value1, actualValue1);

            core.SetProperty("foo", value2);
            var actualValue2 = core.GetProperty <string>("foo");

            Assert.Equal(value2, actualValue2);

            core.SetProperty("foo", value3);
            var actualValue3 = core.GetProperty <bool>("foo");

            Assert.Equal(value3, actualValue3);

            core.SetProperty("foo", value4);
            var actualValue4 = core.GetProperty <object>("foo");

            Assert.Equal(value4, actualValue4);
        }
Exemplo n.º 2
0
        public void TestHasProperty()
        {
            var core = new SMTPServer(DefaultLoader());

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

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

            core.SetProperty("foo", null);
            Assert.False(core.HasProperty("foo"));
        }
Exemplo n.º 3
0
        public void TestGetListProperty()
        {
            var core = new SMTPServer(DefaultLoader());

            var list = core.GetListProperty <string>("foo");

            Assert.NotNull(list);
            Assert.Empty(list);

            list.Add("fubar");

            list = core.GetListProperty <string>("foo");

            Assert.NotNull(list);
            Assert.Contains("fubar", list);

            core.SetProperty("foo", null);

            list = core.GetListProperty <string>("foo");

            Assert.NotNull(list);
            Assert.Empty(list);
        }