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)); }
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); }
public IEnumerable <IServerPark> GetServerParks() { return(_parkService.GetServerParks(_connectionModel)); }