public void Initialize() { // Arrange var ownerRepo = new FakeOwnerRepository(); var uow = new UnitofWork { OwnerRepository = ownerRepo }; Controller = new OwnersController(uow); }
public void Initialize() { // Arrange //UOW var ownerProfileRepo = new FakeOwnerRepository(); var uow = new UnitofWork { OwnerRepository = ownerProfileRepo }; //MEMBERSHIP var membershipMock = new Mock<IMembershipService>(); var userMock = new Mock<MembershipUser>(); //OR // var userIdentity = new UserIdentity(Uow, new FakeMembershipProvider()); //HELPER var mockHelper = new Mock<IUserHelper>(); mockHelper.Setup(x => x.OwnerPublicProfileHelper).Returns(new OwnerPublicProfileHelper(uow, membershipMock.Object)); //Init Controller = new OwnerProfileController(uow, mockHelper.Object); }
public void Initialize() { // Arrange #region AccountHelperTest #region Repo var maintenanceCompanyLookUpRepo = new FakeMaintenanceCompanyLookUpRepository(); var maintenanceCompanyRepo = new FakeMaintenanceCompanyRepository(); var maintenanceCompanySpecializationRepo = new FakeMaintenanceCompanySpecializationRepository(); var maintenanceCustomServicesRepo = new FakeMaintenanceCustomServiceRepository(); var maintenanceExteriorRepo = new FakeMaintenanceExteriorRepository(); var maintenanceInteriorRepo = new FakeMaintenanceInteriorRepository(); var maintenanceNewConstructionRepo = new FakeMaintenanceNewConstructionRepository(); var maintenanceRepairRepo = new FakeMaintenanceRepairRepository(); var maintenanceUtilityRepo = new FakeMaintenanceUtilityRepository(); var currencyRepo = new FakeCurrencyRepository(); var specialistProfileCommentRepo = new FakeSpecialistProfileCommentRepository(); var specialistWorkRepo = new FakeSpecialistWorkRepository(); var agentRepo = new FakeAgentRepository(); var ownerRepo = new FakeOwnerRepository(); var specialistRepo = new FakeSpecialistRepository(); var tenantRepo = new FakeTenantRepository(); var providerRepo = new FakeMaintenanceProviderRepository(); Uow = new UnitofWork { MaintenanceCompanyLookUpRepository = maintenanceCompanyLookUpRepo, MaintenanceCompanyRepository = maintenanceCompanyRepo, MaintenanceCompanySpecializationRepository = maintenanceCompanySpecializationRepo, MaintenanceCustomServiceRepository = maintenanceCustomServicesRepo, MaintenanceExteriorRepository = maintenanceExteriorRepo, MaintenanceInteriorRepository = maintenanceInteriorRepo, MaintenanceNewConstructionRepository = maintenanceNewConstructionRepo, MaintenanceRepairRepository = maintenanceRepairRepo, MaintenanceUtilityRepository = maintenanceUtilityRepo, CurrencyRepository = currencyRepo, SpecialistProfileCommentRepository = specialistProfileCommentRepo, SpecialistWorkRepository = specialistWorkRepo, AgentRepository = agentRepo, OwnerRepository = ownerRepo, SpecialistRepository = specialistRepo, TenantRepository = tenantRepo, MaintenanceProviderRepository = providerRepo }; #endregion #region Mocking IUserHelper #region AccountHelper UserHelper var mockHelper = new Mock<IUserHelper>(); mockHelper. Setup(x => x.UserIdentity). Returns(new UserIdentity(Uow, new FakeMembershipProvider())); mockHelper. Setup(x => x.AgentPrivateProfileHelper). Returns(AgentPrivateProfileHelperMock); mockHelper. Setup(x => x.OwnerPrivateProfileHelper). Returns(OwnerPrivateProfileHelperMock); mockHelper. Setup(x => x.ProviderPrivateProfileHelper). Returns(ProviderPrivateProfileHelperMock); mockHelper. Setup(x => x.SpecialistPrivateProfileHelper). Returns(SpecialistPrivateProfileHelperMock); mockHelper. Setup(x => x.TenantPrivateProfileHelper). Returns(TenantPrivateProfileHelperMock); #endregion #endregion #region Mocking MemberShipService //MembershipService Optional var membershipMock = new Mock<IMembershipService>(); //var userMock = new Mock<MembershipUser>(); //var secondSpecialist = professionalRepo.MyList[1]; //userMock.Setup(u => u.ProviderUserKey).Returns(secondSpecialist.GUID); //userMock.Setup(u => u.UserName).Returns(secondSpecialist.FirstName); //membershipMock.Setup(s => s.GetUser(It.IsAny<string>())).Returns(userMock.Object); #endregion #region Controller Construction + Mocking Context Controller = new AccountHelper(Uow, membershipMock.Object, mockHelper.Object, new MockEmailService()); Controller.MockHttpContext(); #endregion #region ExpectedResult Helper ExpectedOwner = new ExpectedHelper(Uow).GetExpectedOwner(); ExpectedAgent = new ExpectedHelper(Uow).GetExpectedAgent(); ExpectedTenant = new ExpectedHelper(Uow).GetExpectedTenant(); ExpectedProvider = new ExpectedHelper(Uow).GetExpectedProvider(); ExpectedSpecialist = new ExpectedHelper(Uow).GetExpectedSpecialist(); #endregion #endregion //AccountHelperTest }
public void Initialize() { // Arrange var maintenanceCompanyLookUpRepo = new FakeMaintenanceCompanyLookUpRepository(); var maintenanceRepairRepo = new FakeMaintenanceRepairRepository(); var maintenanceCompanySpecializationRepo = new FakeMaintenanceCompanySpecializationRepository(); var currencyRepo = new FakeCurrencyRepository(); var specialistProfileCommentRepo = new FakeSpecialistProfileCommentRepository(); var specialistWorkRepo = new FakeSpecialistWorkRepository(); var agentRepo = new FakeAgentRepository(); var ownerRepo = new FakeOwnerRepository(); var specialistRepo = new FakeSpecialistRepository(); var tenantRepo = new FakeTenantRepository(); var providerRepo = new FakeMaintenanceProviderRepository(); Uow = new UnitofWork { MaintenanceCompanyLookUpRepository = maintenanceCompanyLookUpRepo, MaintenanceRepairRepository = maintenanceRepairRepo, MaintenanceCompanySpecializationRepository = maintenanceCompanySpecializationRepo, CurrencyRepository = currencyRepo, SpecialistProfileCommentRepository = specialistProfileCommentRepo, SpecialistWorkRepository = specialistWorkRepo, AgentRepository = agentRepo, OwnerRepository = ownerRepo, SpecialistRepository = specialistRepo, TenantRepository = tenantRepo, MaintenanceProviderRepository = providerRepo }; }
public void Initialize() { // Arrange #region AccountHelperTest #region Repo var maintenanceCompanyLookUpRepo = new FakeMaintenanceCompanyLookUpRepository(); var maintenanceCompanyRepo = new FakeMaintenanceCompanyRepository(); var maintenanceCompanySpecializationRepo = new FakeMaintenanceCompanySpecializationRepository(); var maintenanceCustomServicesRepo = new FakeMaintenanceCustomServiceRepository(); var maintenanceExteriorRepo = new FakeMaintenanceExteriorRepository(); var maintenanceInteriorRepo = new FakeMaintenanceInteriorRepository(); var maintenanceNewConstructionRepo = new FakeMaintenanceNewConstructionRepository(); var maintenanceRepairRepo = new FakeMaintenanceRepairRepository(); var maintenanceUtilityRepo = new FakeMaintenanceUtilityRepository(); var currencyRepo = new FakeCurrencyRepository(); var specialistProfileCommentRepo = new FakeSpecialistProfileCommentRepository(); var specialistWorkRepo = new FakeSpecialistWorkRepository(); var agentRepo = new FakeAgentRepository(); var ownerRepo = new FakeOwnerRepository(); var specialistRepo = new FakeSpecialistRepository(); var tenantRepo = new FakeTenantRepository(); var providerRepo = new FakeMaintenanceProviderRepository(); Uow = new UnitofWork { MaintenanceCompanyLookUpRepository = maintenanceCompanyLookUpRepo, MaintenanceCompanyRepository = maintenanceCompanyRepo, MaintenanceCompanySpecializationRepository = maintenanceCompanySpecializationRepo, MaintenanceCustomServiceRepository = maintenanceCustomServicesRepo, MaintenanceExteriorRepository = maintenanceExteriorRepo, MaintenanceInteriorRepository = maintenanceInteriorRepo, MaintenanceNewConstructionRepository = maintenanceNewConstructionRepo, MaintenanceRepairRepository = maintenanceRepairRepo, MaintenanceUtilityRepository = maintenanceUtilityRepo, CurrencyRepository = currencyRepo, SpecialistProfileCommentRepository = specialistProfileCommentRepo, SpecialistWorkRepository = specialistWorkRepo, AgentRepository = agentRepo, OwnerRepository = ownerRepo, SpecialistRepository = specialistRepo, TenantRepository = tenantRepo, MaintenanceProviderRepository = providerRepo }; #endregion #region Mocking IUserHelper #region AccountHelper UserHelper var mockHelper = new Mock<IUserHelper>(); mockHelper. Setup(x => x.UserIdentity). Returns(new UserIdentity(Uow, new FakeMembershipProvider())); mockHelper. Setup(x => x.AgentPrivateProfileHelper). Returns(AgentPrivateProfileHelperMock); mockHelper. Setup(x => x.OwnerPrivateProfileHelper). Returns(OwnerPrivateProfileHelperMock); mockHelper. Setup(x => x.ProviderPrivateProfileHelper). Returns(ProviderPrivateProfileHelperMock); mockHelper. Setup(x => x.SpecialistPrivateProfileHelper). Returns(SpecialistPrivateProfileHelperMock); mockHelper. Setup(x => x.TenantPrivateProfileHelper). Returns(TenantPrivateProfileHelperMock); #endregion #endregion #region Mocking MemberShipService var fakeMemberShipService = new FakeMemberShipService(); #endregion #region Controller Construction + Mocking Context Controller = new TenantController(Uow, fakeMemberShipService, mockHelper.Object); Controller.MockHttpContext(); #endregion #region ExpectedResult Helper ExpectedOwner = new ExpectedHelper(Uow).GetExpectedOwner(); ExpectedAgent = new ExpectedHelper(Uow).GetExpectedAgent(); ExpectedTenant = new ExpectedHelper(Uow).GetExpectedTenant(); ExpectedProvider = new ExpectedHelper(Uow).GetExpectedProvider(); ExpectedSpecialist = new ExpectedHelper(Uow).GetExpectedSpecialist(); #endregion #endregion //AccountHelperTest }