public void ContactWithSubscriberIdWillNotBeExported() { DatabaseExportContactToMailrelay databaseExportContactToMailrelay = CreateDatabaseUpdateMailrelayGroup(_list); ExportContactToMailrelay exportContactToMailrelay = new ExportContactToMailrelay(Connection, databaseExportContactToMailrelay); exportContactToMailrelay.ChangeMailrelayConnection(_mailrelayConnectionTester); _mailrelayConnectionTester.replies.Enqueue(new MailrelayIntReply() { status = 1, data = 1 }); exportContactToMailrelay.ExecuteOption(new Administration.Option.Options.OptionReport(typeof(ExportContactToMailrelayTest))); Assert.AreEqual(1, _mailrelayConnectionTester.sendFunctions.Count); }
public void ContactWithoutSubscriberIdWillBeExported() { _contact.new_mailrelaysubscriberid = null; _contact.Update(); int newId = _random.Next(0, int.MaxValue); DatabaseExportContactToMailrelay databaseExportContactToMailrelay = CreateDatabaseUpdateMailrelayGroup(_list); ExportContactToMailrelay exportContactToMailrelay = new ExportContactToMailrelay(Connection, databaseExportContactToMailrelay); exportContactToMailrelay.ChangeMailrelayConnection(_mailrelayConnectionTester); _mailrelayConnectionTester.replies.Enqueue(new MailrelayIntReply() { status = 1, data = 1 }); _mailrelayConnectionTester.replies.Enqueue(new MailrelayIntReply() { status = 1, data = newId }); exportContactToMailrelay.ExecuteOption(new Administration.Option.Options.OptionReport(typeof(ExportContactToMailrelayTest))); MarketingList listRead = MarketingList.GetListForMailrelayUpdate(DynamicsCrmConnection, new PagingInformation(), _list.Id); Contact contactRead = Contact.ReadFromFetchXml(DynamicsCrmConnection, new List <string>() { "contactid", "new_mailrelaysubscriberid" }, new Dictionary <string, string>() { { "contactid", _contact.Id.ToString() } }).Single(); Assert.AreEqual(1, _mailrelayConnectionTester.sendFunctions.Count(function => function.GetType() == typeof(addSubscriber))); Assert.IsNotNull(listRead.new_mailrelaygroupid); Assert.AreEqual(newId, contactRead.new_mailrelaysubscriberid); }