示例#1
0
        public void NewGroupMemberWillBeAdded()
        {
            DatabaseUpdateMailrelayGroup databaseUpdateMailrelayGroup = CreateDatabaseUpdateMailrelayGroup(_list);

            UpdateMailrelayGroup updateMailrelayGroup = new UpdateMailrelayGroup(Connection, databaseUpdateMailrelayGroup);

            updateMailrelayGroup.ChangeMailrelayConnection(_mailrelayConnectionTester);

            _mailrelayConnectionTester.replies.Enqueue(new MailrelayIntReply()
            {
                status = 1, data = _groupId
            });
            _mailrelayConnectionTester.replies.Enqueue(new MailrelayArrayReply <getSubscribersReply>()
            {
                status = 1, data = new List <getSubscribersReply>()
            });
            EnqueueGetSubscribersReply(_contact.new_mailrelaysubscriberid.Value);
            _mailrelayConnectionTester.replies.Enqueue(new MailrelayBoolReply()
            {
                status = 1, data = true
            });

            updateMailrelayGroup.ExecuteOption(new Administration.Option.Options.OptionReport(typeof(UpdateMailrelayGroupTest)));

            Assert.AreEqual(1, _mailrelayConnectionTester.sendFunctions.Count(function => function.GetType() == typeof(updateSubscriber)));
        }
示例#2
0
        public void GroupMemberCanBeRemoved()
        {
            DatabaseUpdateMailrelayGroup databaseUpdateMailrelayGroup = CreateDatabaseUpdateMailrelayGroup(_list);
            int idFromMailrelay = _random.Next(0, int.MaxValue);

            UpdateMailrelayGroup updateMailrelayGroup = new UpdateMailrelayGroup(Connection, databaseUpdateMailrelayGroup);

            updateMailrelayGroup.ChangeMailrelayConnection(_mailrelayConnectionTester);

            _mailrelayConnectionTester.replies.Enqueue(new MailrelayIntReply()
            {
                status = 1, data = _groupId
            });
            EnqueueGetSubscribersReply(_contact.new_mailrelaysubscriberid.Value, idFromMailrelay);
            _mailrelayConnectionTester.replies.Enqueue(new MailrelayBoolReply()
            {
                status = 1, data = true
            });

            updateMailrelayGroup.ExecuteOption(new Administration.Option.Options.OptionReport(typeof(UpdateMailrelayGroupTest)));

            updateSubscriber updateSubscriberFunction = (updateSubscriber)_mailrelayConnectionTester.sendFunctions.Single(function => function.GetType() == typeof(updateSubscriber));

            Assert.AreEqual(0, updateSubscriberFunction.groups.Count);
        }
示例#3
0
        public void NewGroupWillNotBeCreatedIfItExists()
        {
            DatabaseUpdateMailrelayGroup databaseUpdateMailrelayGroup = CreateDatabaseUpdateMailrelayGroup(_list);

            _list.new_mailrelaygroupid = _groupId;
            _list.UpdateMailrelaygroupid(DynamicsCrmConnection);

            UpdateMailrelayGroup updateMailrelayGroup = new UpdateMailrelayGroup(Connection, databaseUpdateMailrelayGroup);

            updateMailrelayGroup.ChangeMailrelayConnection(_mailrelayConnectionTester);

            EnqueueGetSubscribersReply(_contact.new_mailrelaysubscriberid.Value);

            updateMailrelayGroup.ExecuteOption(new Administration.Option.Options.OptionReport(typeof(UpdateMailrelayGroupTest)));
        }
示例#4
0
 public UpdateMailrelayGroup(MongoConnection connection, DataLayer.MongoData.Option.OptionBase databaseOption) : base(connection, databaseOption)
 {
     _databaseUpdateMailrelayGroup = (DatabaseUpdateMailrelayGroup)databaseOption;
 }