public void InsertLeadScoreRule_ValidRule_Succeed() { LeadScoreRuleViewModel viewModel = LeadScoreRuleMockData.GetLeadscoreRuleViewModel(); mockLeadScoreRuleRepository.Setup(mnt => mnt.Insert(It.IsAny <LeadScoreRule>())).Verifiable("Error ocuured while calling repository method"); InsertLeadScoreRuleResponse response = leadScoreRuleService.CreateRule(new InsertLeadScoreRuleRequest() { LeadScoreRuleViewModel = viewModel }); mockRepository.VerifyAll(); }
public void InsertLeadScoreRule_RunTimeException_ExceptionDetails() { LeadScoreRuleViewModel leadScoreViewModel = LeadScoreRuleMockData.GetLeadscoreRuleViewModel(); mockLeadScoreRuleRepository.Setup(c => c.Insert(It.IsAny <LeadScoreRule>())).Throws(new NullReferenceException()); InsertLeadScoreRuleResponse response = leadScoreRuleService.CreateRule(new InsertLeadScoreRuleRequest() { LeadScoreRuleViewModel = leadScoreViewModel }); mockRepository.VerifyAll(); Assert.AreEqual(typeof(NullReferenceException), response.Exception.GetType()); Assert.AreNotEqual(null, response.Exception); }