public void RespondToOpportunityForMultipleParticipants() { const string pageKey = "OpportunityResponses"; var p1 = new Dictionary<string, object> { {"Response_Date", It.IsAny<DateTime>()}, {"Opportunity_ID", 1}, {"Participant_ID", 100}, {"Closed", false}, {"Comments", It.IsAny<string>()} }; var token = It.IsAny<string>(); _ministryPlatformService.Setup(m => m.CreateRecord(pageKey, p1, token, true)).Returns(27); var dto = new RespondToOpportunityDto {OpportunityId = 1, Participants = new List<int> {100, 200, 300}}; Assert.DoesNotThrow(() => _fixture.RespondToOpportunity(dto)); _ministryPlatformService.Verify( m => m.CreateRecord(It.IsAny<string>(), It.IsAny<Dictionary<string, object>>(), It.IsAny<string>(), true), Times.Exactly(3)); }
public void RespondToOpportunity(RespondToOpportunityDto opportunityResponse) { foreach (var participant in opportunityResponse.Participants) { var comments = string.Format("Request on {0}", DateTime.Now.ToString(CultureInfo.CurrentCulture)); var values = new Dictionary<string, object> { {"Response_Date", DateTime.Now}, {"Opportunity_ID", opportunityResponse.OpportunityId}, {"Participant_ID", participant}, {"Closed", false}, {"Comments", comments} }; _ministryPlatformService.CreateRecord("OpportunityResponses", values, ApiLogin(), true); } }