예제 #1
0
        public void Given_I_Call_GetServerParks_Then_The_Correct_Method_Is_called_On_The_Api()
        {
            //arrange
            var serverPark1Mock = new Mock <IServerPark>();

            serverPark1Mock.Setup(s => s.Name).Returns("ServerParkA");
            var serverPark2Mock = new Mock <IServerPark>();

            serverPark2Mock.Setup(s => s.Name).Returns("ServerParkB");

            var serverParkList = new List <IServerPark>
            {
                serverPark1Mock.Object,
                serverPark2Mock.Object
            };

            _blaiseApiMock.Setup(b => b.GetServerParks()).Returns(serverParkList);

            //act
            _sut.GetServerParks();

            //assert
            _blaiseApiMock.Verify(v => v.GetServerParks(), Times.Once);
            _mapperMock.Verify(v => v.MapToServerParkDtos(serverParkList));
        }
        public IHttpActionResult GetServerParks()
        {
            _loggingService.LogInfo("Obtaining a list of server parks");

            var parks = _serverParkService.GetServerParks().ToList();

            _loggingService.LogInfo($"Successfully received a list of server parks '{string.Join(", ", parks)}'");

            return(Ok(parks));
        }
예제 #3
0
        public List <CatiInstrumentDto> GetCatiInstruments()
        {
            var serverParks     = _serverParkService.GetServerParks();
            var catiInstruments = new List <CatiInstrumentDto>();

            foreach (var serverPark in serverParks)
            {
                var instruments = _blaiseApi.GetInstalledSurveys(serverPark.Name);
                catiInstruments.AddRange(GetCatiInstruments(instruments));
            }

            return(catiInstruments);
        }
예제 #4
0
 public IEnumerable <IServerPark> GetServerParks()
 {
     return(_parkService.GetServerParks(_connectionModel));
 }