Example #1
0
 public EstablishmentsController(ILogger <EstablishmentsController> logger, EstablishmentService establishmentService, ControllerMessages responseMessages)
 {
     this.logger = logger;
     this.establishmentService = establishmentService;
     this.httpResponseHelper   = new HttpResponseHelper();
     this.responseMessages     = responseMessages;
 }
Example #2
0
 public ReleasesController(ILogger <ReleasesController> logger, ReleasesService releasesService, EstablishmentService establishmentService, ControllerMessages responseMessages)
 {
     this.logger               = logger;
     this.releasesService      = releasesService;
     this.establishmentService = establishmentService;
     this.responseMessages     = responseMessages;
     this.httpResponseHelper   = new HttpResponseHelper();
 }
 public EstablishmentTest()
 {
     _establishmnetRepository        = new Mock <IEstablishmentRepository>();
     _establishmentAddressRepository = new Mock <IEstablishmentAddressRepository>();
     _establishmentAccountRepository = new Mock <IEstablishmentAccountRepository>();
     _validateService      = new ValidateService();
     _establishmentService = new EstablishmentService(_establishmnetRepository.Object, _establishmentAddressRepository.Object,
                                                      _establishmentAccountRepository.Object, _validateService);
     SetupMock();
 }
Example #4
0
        public DatabaseSettingsFixture()
        {
            var mockDatabaseSettings = new Mock <IDatabaseConnectorSettings>();

            mockDatabaseSettings.SetupGet(mi => mi.DatabaseName).Returns("extratos-api-establishmentDB-test");
            mockDatabaseSettings.SetupGet(mi => mi.ConnectionString).Returns("mongodb+srv://rw-permission-user:[email protected]/?ssl=true&authSource=admin&w=majority");
            mockDatabaseSettings.SetupGet(mi => mi.CollectionName).Returns("");

            this.dbSettings           = mockDatabaseSettings.Object;
            this.establishmentService = new EstablishmentService(dbSettings);
        }
Example #5
0
        public EstablishmentViewModel(EstablishmentType establishmentType)
        {
            _establishmentType = establishmentType;
            SearchCommand      = new Command(Search);
            DetailCommand      = new Command <Establishment>(Detail);

            var allEstablishment = new EstablishmentService().GetEstablishments();
            var allStores        = allEstablishment.Where(a => a.Type == _establishmentType).ToList();

            Establishments     = allStores;
            _allEstablishments = allStores;
        }
        public void WhenGetEstablishmentByURNIsCalledEstablishmenMeasuresShouldMapCorrectly()
        {
            var establishmentService = new EstablishmentService(_repository.Object, _configuration.Object);

            var result = establishmentService.GetByURN(CheckingWindow.KS4June, new URN(_testUrn));

            _repository.Verify(x => x.Get <EstablishmentDTO>(_ks4JuneEstablishments), Times.Once);

            Assert.NotNull(result);
            Assert.NotNull(result.PerformanceMeasures);
            Assert.True(result.PerformanceMeasures.Count > 0);
            Assert.True(result.PerformanceMeasures.First().Name == "N01");
            Assert.True(result.PerformanceMeasures.First().Value == "V01");
        }
        public void WhenGetEstablishmentByDFESNumberIsCalledEstablishmentDTOMapsRootFieldsToEntityObject()
        {
            var establishmentService = new EstablishmentService(_repository.Object, _configuration.Object);

            var result = establishmentService.GetByDFESNumber(CheckingWindow.KS4June, $"99{_testUrn}");

            _repository.Verify(x => x.Get <EstablishmentDTO>(_ks4JuneEstablishments), Times.Once);

            Assert.NotNull(result);
            Assert.True(result.DfesNumber == int.Parse($"99{_testUrn}"));
            Assert.True(result.SchoolName == _testEstab.SchoolName);
            Assert.True(result.SchoolType == _testEstab.SchoolType);
            Assert.True(result.Urn.Value == _testUrn);
        }
 public EstablishmentsController(FitcardContext fitcardContext, EstablishmentService establishmentService, StatusService statusService,
                                 UFService uFService, AddressService addressService, CategoryService categoryService,
                                 AccountService accountService, CityService cityService, ContactService contactService)
 {
     _FitcardContext       = fitcardContext;
     _EstablishmentService = establishmentService;
     _StatusService        = statusService;
     _UFService            = uFService;
     _AddressService       = addressService;
     _CategoryService      = categoryService;
     _AccountService       = accountService;
     _CityService          = cityService;
     _ContactService       = contactService;
 }
Example #9
0
        public EstablishmentControllerTests(DatabaseSettingsFixture dbFixture)
        {
            // 0: Setting wrapper for logger
            loggerWrapper = new LoggerWrapper <EstablishmentsController>();

            // 1: Setting establishment service given db settings
            this.dbSettings           = dbFixture.dbSettings;
            this.establishmentService = dbFixture.establishmentService;

            // 2: Get controller messages
            this.controllerMessages = GetControllerMessagesProperties();

            // 3: Instantiate of Establishment Controller
            this.establishmentsController = new EstablishmentsController(loggerWrapper, establishmentService, controllerMessages);
        }
Example #10
0
        public EstablishmentViewModel(EstablishmentType establishmenType)
        {
            if (String.IsNullOrEmpty(SearchWord))
            {
                SearchWord = "";
            }
            _establishmenType = establishmenType;
            //faz o vinculo na hora que carrega a pagina
            SearchCommand = new Command(Search);
            //Indica o tipo de objeto que vai tá passando no parametro
            DetailCommand = new Command <Establishment>(Detail);
            //--------------------------------------------------
            var allEstablishment = new EstablishmentService().GetEstablishments();
            var allStores        = allEstablishment.Where(e => e.Type == _establishmenType).ToList();

            Establishments    = allStores;
            _allEstablishment = allStores;
        }
        public void WhenGetEstablishmentByURNIsCalledEstablishmentDTOMapsRootFieldsToEntityObject()
        {
            var establishmentService = new EstablishmentService(_repository.Object, _configuration.Object);

            var result = establishmentService.GetByURN(CheckingWindow.KS4June, new URN(_testUrn));

            _repository.Verify(x => x.Get <EstablishmentDTO>(_ks4JuneEstablishments), Times.Once);

            Assert.NotNull(result);
            Assert.True(result.DfesNumber.ToString() == _testEstab.DFESNumber);
            Assert.True(result.SchoolName == _testEstab.SchoolName);
            Assert.True(result.SchoolType == _testEstab.SchoolType);
            Assert.True(result.InstitutionTypeNumber == _testEstab.InstitutionTypeNumber);
            Assert.True(result.LowestAge == _testEstab.LowestAge);
            Assert.True(result.HighestAge == _testEstab.HighestAge);
            Assert.True(result.HeadTeacher == _testEstab.HeadTitleCode + " " + _testEstab.HeadFirstName + " " + _testEstab.HeadLastName);
            Assert.True(result.Urn.Value == _testUrn);
        }
 public EstablishmentsController(EstablishmentService establishmentService)
 {
     _establishmentService = establishmentService;
 }
Example #13
0
 public EstablishmentServiceTestsBase()
 {
     MockHttpProvider = new Mock <IHttpProvider>();
     HttpService      = new HttpService(MockHttpProvider.Object);
     Service          = new EstablishmentService(HttpService);
 }