示例#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);
        }
示例#2
0
        public void TestGetNonExistantProperty()
        {
            var core = new SMTPServer(DefaultLoader());

            Assert.Equal(default(int), core.GetProperty <int>("nonExistant"));
            Assert.Equal(default(bool), core.GetProperty <bool>("nonExistant"));
            Assert.Equal(default(string), core.GetProperty <string>("nonExistant"));
        }