Exemple #1
0
        public void Reset_Should_Work()
        {
            var guid = Guid.NewGuid().ToString();

            _list.Archiving.Archive = true;
            _list.AutoResponder.AutoresponsePostingsText = guid;
            _list.BounceProcessing.BounceNotifyOwnerOnBounceIncrement = true;
            _list.ContentFiltering.FilterMimeTypes.Add(guid);
            _list.Digest.DigestFooter = guid;
            _list.General.Description = Guid.NewGuid().ToString();
            _list.MailNewsGateways.LinkedNewsgroup = guid;
            _list.NonDigest.MsgFooter = guid;
            _list.Privacy.AcceptTheseNonmembers.Add(guid);
            _list.Topics.TopicsBodylinesLimit = 42;
            _list.AdminPassword = guid;
            _list.AdminUrl      = guid;
            _list.Reset();


            var expected = new MailmanList();

            _list.AdminPassword.Should().Be(expected.AdminPassword);
            _list.AdminUrl.Should().Be(expected.AdminUrl);

            var config = JObject.Parse(_list.CurrentConfig);

            config["Meta"]["ExportedDate"] = DateTime.Today;
            var expectedConfig = JObject.Parse(expected.CurrentConfig);

            expectedConfig["Meta"]["ExportedDate"] = DateTime.Today;
            config.Should().BeEquivalentTo(expectedConfig);
        }
        public void MalformedJson_To_List_Should_Throw(string input)
        {
            var    list = new MailmanList();
            Action act  = () => list.LoadConfig(input);

            act.Should().Throw <JsonException>();
        }
        public void Wrong_Section_Should_Throw()
        {
            var    list = new MailmanList();
            var    json = "{ \"WrongSection\": { \"Description\": \"foobar\" } }";
            Action act  = () => list.General.LoadConfig(json);

            act.Should().Throw <JsonException>().WithMessage("Incorrect root property name.");
        }
        public void General_Should_Ignore_RealName()
        {
            var list = new MailmanList();
            var guid = Guid.NewGuid().ToString();

            list.General.RealName = guid;
            var json = "{ \"General\": { \"Description\": \"foobar\", \"RealName\": \"sdkjfnjdknf\" } }";

            list.General.LoadConfig(json);
            list.General.Description.Should().Be("foobar");
            list.General.RealName.Should().Be(guid);
        }
Exemple #5
0
        public void ResetClient_Should_Work()
        {
            var list = new MailmanList();

            list.Client.Authenticator      = new SimpleAuthenticator(null, null, null, null);
            list.Client.ClientCertificates = new X509CertificateCollection(new[] { new X509Certificate() });
            list.Client.FollowRedirects    = false;
            list.Client.MaxRedirects       = 99;
            list.Client.Proxy     = new WebProxy();
            list.Client.Timeout   = 42;
            list.Client.UserAgent = Guid.NewGuid().ToString();
            list.Client.UseSynchronizationContext = true;

            list.ResetClient();

            var expected = new MailmanList().Client;

            list.Client.Should().BeEquivalentTo(expected);
        }