public void TestCreateInvitation() { var dto = new MpInvitation { EmailAddress = "*****@*****.**", GroupRoleId = 11, RecipientName = "James Howlett", InvitationType = 33, RequestDate = DateTime.Now, SourceId = 44 }; const int invitationId = 987; const string invitationGuid = "1020304050"; var created = new Dictionary <string, object> { { "Invitation_GUID", invitationGuid } }; _ministryPlatformService.Setup( mocked => mocked.CreateRecord(InvitationPageId, It.Is <Dictionary <string, object> >( d => d.ToInt("Source_ID", false) == dto.SourceId && d.ToString("Email_Address").Equals(dto.EmailAddress) && d.ToString("Recipient_Name").Equals(dto.RecipientName) && d.ToInt("Group_Role_ID", false) == dto.GroupRoleId && d.ToInt("Invitation_Type_ID", false) == dto.InvitationType /*&& d["Invitation_Date"].Equals(dto.RequestDate)*/), It.IsAny <string>(), true)).Returns(invitationId); _ministryPlatformService.Setup(mocked => mocked.GetRecordDict(InvitationPageId, invitationId, It.IsAny <string>(), false)).Returns(created); var result = _fixture.CreateInvitation(dto); _ministryPlatformService.VerifyAll(); Assert.IsNotNull(result); Assert.AreSame(dto, result); Assert.AreEqual(invitationId, result.InvitationId); Assert.AreEqual(invitationGuid, result.InvitationGuid); }