public void TestAccountDetailsNull() { //Arrange Mock <IAccountDetailsRepository> mockAccountDetailsRepository = new Mock <IAccountDetailsRepository>(); mockAccountDetailsRepository.Setup(service => service.GetAccountDetails()); IAccountDetailsApplicationService accountDetailsApplicationService = new AccountDetailsApplicationService(mockAccountDetailsRepository.Object); //Act & Assert Assert.Throws <NullReferenceException>(() => accountDetailsApplicationService.GetAccountDetails()); }
public void TestAccountDetails() { //Arrange Mock <IAccountDetailsRepository> mockAccountDetailsRepository = new Mock <IAccountDetailsRepository>(); mockAccountDetailsRepository.Setup(service => service.GetAccountDetails()) .Returns(new List <AccountDetails>() { new AccountDetails(), new AccountDetails() }); IAccountDetailsApplicationService accountDetailsApplicationService = new AccountDetailsApplicationService(mockAccountDetailsRepository.Object); //Act IList <AccountDetailsDto> result = accountDetailsApplicationService.GetAccountDetails(); //Assert Assert.IsAssignableFrom <IList <AccountDetailsDto> >(result); }