public void DealManager_Get_ShouldCall_RepositoryGet_Negative() { // Arrange Mock <IDealRepository> dealRepository = new Mock <IDealRepository>(); Mock <ITblDealRepository> tblDealRepository = new Mock <ITblDealRepository>(); SetupDealRepository(dealRepository, true); DealManager dealManager = new DealManager(userManager.Object, cacheStoreManager, mockLogManager.Object, dealRepository.Object, new Mock <IWorkbenchDealsRepository>().Object, new Mock <ITblDealRepository>().Object, new Mock <IDealStatusesLookupManager>().Object, new Mock <IEntityLockManager>().Object, transformationManager, new Mock <ICedantManager>().Object, new Mock <IBrokerManager>().Object, new Mock <ITblClausesDealRepository>().Object); //Act Assert.That(() => dealManager.GetDeal(123), Throws.Exception); }
public void DealManager_Get_ShouldCall_RepositoryGet() { // Arrange Mock <IDealRepository> dealRepository = new Mock <IDealRepository>(); SetupDealRepository(dealRepository, false); DealManager dealManager = new DealManager(userManager.Object, cacheStoreManager, mockLogManager.Object, dealRepository.Object, new Mock <IWorkbenchDealsRepository>().Object, new Mock <ITblDealRepository>().Object, new Mock <IDealStatusesLookupManager>().Object, new Mock <IEntityLockManager>().Object, transformationManager, new Mock <ICedantManager>().Object, new Mock <IBrokerManager>().Object, new Mock <ITblClausesDealRepository>().Object); //Act var dealNumber = 123; EntityResult <BLL_Deal> actual = dealManager.GetDeal(dealNumber); //Assert dealRepository.Verify(p => p.Get(It.IsAny <Expression <Func <grs_VGrsDeal, bool> > >())); Assert.IsNotNull(actual.Data); Assert.AreEqual(dealNumber, actual.Data.Dealnum); }