public AgencyTest()
 {
     //Arrange
     controller = new AgenciesController(new InMemoryAgencyAgent());
     //must set explicitly for tests to work
     controller.ObjectValidator = new InMemoryModelValidator();
 }
        public void SetUp()
        {
            realEstatesServiceMock = new Mock <IRealEstatesService>();
            agenciesMock           = new Mock <IAgenciesService>();
            rolesServiceMock       = new Mock <IUsersRolesService>();
            usersServiceMock       = new Mock <IUsersService>();
            paymentMock            = new Mock <IPaymentDetailsService>();
            invoiceMock            = new Mock <IInvoicesService>();

            controller = new AgenciesController(usersServiceMock.Object, agenciesMock.Object
                                                , paymentMock.Object, rolesServiceMock.Object, invoiceMock.Object);
        }
Example #3
0
        public void SetUp()
        {
            ServiceLocatorInitializer.Init();

            _agencyManagementService =
                MockRepository.GenerateMock <IAgencyManagementService>();

            _agencySearchManagementService =
                MockRepository.GenerateMock <IAgencySearchManagementService>();
            _personManagementService = MockRepository.GenerateMock <IPersonManagementService>();
            _authenticationProvider  = MockRepository.GenerateMock <IAuthenticationProvider>();
            _agenciesController      =
                new AgenciesController(_agencyManagementService, _agencySearchManagementService,
                                       _personManagementService, _authenticationProvider);
        }
        public void GetAgencies_AgenciesController_MoqTest()
        {
            mockIUserQueryService.Setup(x => x.GetAgenciesForAdministration(It.IsAny <Guid>()))
            .Returns(agencyReference);
            var controller = new AgenciesController(
                Mock.Of <IAgencyCommandService>(),
                Mock.Of <IAgencyQueryService>(),
                mockISystemQueryService.Object,
                mockIUserQueryService.Object);
            IOrderedEnumerable <AgencyReference> actionResult = controller.GetAgencies(It.IsAny <Guid>());

            agencyReferenceActionList = actionResult.OrderBy(x => x.Name).ToList();
            agencyReference           = agencyReference.OrderBy(x => x.Name).ToList();
            Assert.AreEqual(agencyReference.Count, agencyReferenceActionList.Count);
            Assert.AreEqual(agencyReference[0].AgencyId, agencyReferenceActionList[0].AgencyId);
            Assert.AreEqual(agencyReference[0].Name, agencyReferenceActionList[0].Name);
        }