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))); }
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); }
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))); }
public UpdateMailrelayGroup(MongoConnection connection, DataLayer.MongoData.Option.OptionBase databaseOption) : base(connection, databaseOption) { _databaseUpdateMailrelayGroup = (DatabaseUpdateMailrelayGroup)databaseOption; }