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 //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 #region SpecialistPublicProfileHelper #region Repo var professionalRepo = new FakeSpecialistRepository(); 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 tenantRepo = new FakeTenantRepository(); Uow = new UnitofWork { SpecialistRepository = professionalRepo, MaintenanceCompanyLookUpRepository = maintenanceCompanyLookUpRepo, MaintenanceRepairRepository = maintenanceRepairRepo, MaintenanceCompanySpecializationRepository = maintenanceCompanySpecializationRepo, CurrencyRepository = currencyRepo, SpecialistProfileCommentRepository = specialistProfileCommentRepo, SpecialistWorkRepository = specialistWorkRepo, TenantRepository = tenantRepo }; #endregion #region Mocking Context //MockHelper var specialistPublicProfileHelperController = new SpecialistPublicProfileHelper(Uow, new FakeMembershipProvider(), null); //Context var controllerContext = new Mock<ControllerContext>(); controllerContext.SetupGet(x => x.HttpContext.Request.Url).Returns(new Uri("http://tempuri.org")); specialistPublicProfileHelperController.ControllerContext = controllerContext.Object; #endregion #region Mocking IUserHelper var mockHelper = new Mock<IUserHelper>(); mockHelper. Setup(x => x.SpecialistPublicProfileHelper). Returns(specialistPublicProfileHelperController); mockHelper. Setup(x => x.PosterHelper). Returns(new PosterHelper(Uow, new FakeMembershipProvider())); #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 // Controller = new SpecialistProfileController(Uow, membershipMock.Object, new CoreUserHelper(Uow, membershipMock.Object)); Controller = new SpecialistProfileController(Uow, membershipMock.Object, mockHelper.Object); #endregion #endregion }
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 }