public async ValueTask Setup() { _mapper = Resolve <IMapper>(); _leadRepository = Resolve <ILeadRepository>(); _accountRepository = Resolve <IAccountRepository>(); _systemUnderTest = new LeadController(_leadRepository, _accountRepository, _mapper, _urlOptions); await DropOrRestoreTestDbs("Dbs_Restore"); _leadForTest = (LeadInputModel)LeadInputModelMock.leadInputModel.Clone(); _accountIMForTest = (AccountInputModel)AccountInputModelMock.accountInputModel.Clone(); foreach (var item in LeadInputModelMock.leadsToInsertForSearchTest) { _leadsToInsertForSearch.Add((LeadInputModel)item.Clone()); } foreach (var leadModel in _leadsToInsertForSearch) { ActionResult <LeadOutputModel> leadsInsertActionResult = await _systemUnderTest.AddLead(leadModel); LeadOutputModel outputLead = AssertAndConvert(leadsInsertActionResult); leadModel.Id = outputLead.Id; _leadsForCompare.Add(outputLead); _accountIMForTest.LeadId = (long)outputLead.Id; ActionResult <AccountOutputModel> accountForSearchActionResult = await _systemUnderTest.AddAccount(_accountIMForTest); var accountForSearch = AssertAndConvert(accountForSearchActionResult); _accountsOMForTest.Add(accountForSearch); } }
private async ValueTask TestAddLead() { ActionResult <LeadOutputModel> actionResult = await _systemUnderTest.AddLead(_leadForTest); LeadOutputModel model = AssertAndConvert(actionResult); _leadForTest.Id = model.Id; _accountIMForTest.LeadId = (long)model.Id; DeepEqualForLeadModels(_leadForTest, model); }