public void test_repository_factory_usage() { RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(); IEnumerable<Account> accounts = factoryTest.GetAccounts(); Assert.IsTrue(accounts != null); }
public void test_factory_mocking1() { List<Account> accounts = new List<Account>() { new Account() { AccountId = 1, Description = "Test Account 1", ShortCode="TST1"}, new Account() { AccountId = 2, Description = "Test Account 2", ShortCode="TST2"}, new Account() { AccountId = 3, Description = "Test Account 3", ShortCode="TST3"} }; Mock<IDataRepositoryFactory> mockDataRepository = new Mock<IDataRepositoryFactory>(); mockDataRepository.Setup(obj => obj.GetDataRepository<IAccountRepository>().Get()).Returns(accounts); RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object); IEnumerable<Account> ret = factoryTest.GetAccounts(); Assert.IsTrue(ret == accounts); }