public void test_repository_Mocking() { var userAccounts = new List <UserAccount> { new UserAccount { AccountId = Guid.Parse("3A557B7B-073F-4CCA-B834-CDA95850213E"), CorrelationGuid = Guid.Parse("3A557B7B-073F-4CCA-B834-CDA95850213E"), LoginEmail = "*****@*****.**" }, new UserAccount { AccountId = Guid.Parse("07971F9F-14D8-4127-A5F8-D1B77DCBC218"), CorrelationGuid = Guid.Parse("07971F9F-14D8-4127-A5F8-D1B77DCBC218"), LoginEmail = "*****@*****.**" } }; var userAccountRepositoryMock = new Mock <IAccountRepository>(); userAccountRepositoryMock.Setup(obj => obj.Get()).Returns(userAccounts); var repositoryTestClass = new RepositoryTestClass(userAccountRepositoryMock.Object); var result = repositoryTestClass.GetAccounts(); Assert.IsTrue(Equals(userAccounts, result), "List from repository does not match the class passed into the mock"); }
public void test_repository_Usage_Integration() { var repositoryTestClass = new RepositoryTestClass(); var accounts = repositoryTestClass.GetAccounts(); Assert.IsTrue(accounts != null, "accounts is null"); }
public void test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); IEnumerable <ApplicationUser> users = repositoryTest.GetUsers(); Assert.IsTrue(users != null); }
public void Test_DI_RelationshipGroup_Repository() { //Arrange RepositoryTestClass repoTest = container.GetInstance <RepositoryTestClass>(); //Act IEnumerable <RelationshipGroup> rGroups = repoTest.GetRelationshipGroups(); //Assert Assert.IsTrue(rGroups.Any()); Console.WriteLine($"{ rGroups.Count() }"); }
public void test_repository_mocking() { List <ApplicationUser> clients = new List <ApplicationUser>() { new ApplicationUser() { UserName = "******" }, new ApplicationUser() { UserName = "******" } }; Mock <IUserRepository> mockCarRepository = new Mock <IUserRepository>(); mockCarRepository.Setup(obj => obj.Get()).Returns(clients); RepositoryTestClass repositoryTest = new RepositoryTestClass(mockCarRepository.Object); IEnumerable <ApplicationUser> ret = repositoryTest.GetUsers(); Assert.IsTrue(ret == clients); }