public void GetAirportInformationByAirportCodeWhenParamIsValid()
        {
            Init();

            const string airportCode = "AMS";

            AirportDto airportDto = new AirportDto
            {
                AirportCode = "AMS",
                CityOrAirportName = "AMSTERDAM SCHIPHOL",
                Country = "Netherlands",
                CountryCode = "461",
                LatitudeDegree = "52",
                LongitudeDegree = "4"
            };

            m_ServiceDaoMock.GetAirportInformationByAirportCode(airportCode).Returns(response);

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(response);

            XmlNodeList nodeList = xmlDocument.SelectNodes("NewDataSet/Table");

            if (nodeList != null)
            {
                string serializeObject = nodeList[0].SerializeObject();
                Airport deserializeObject = (Airport)serializeObject.DeserializeObject<Airport>();

                MapToAirport.MapFromObjectToAirport(deserializeObject);
                
                AirportManager airportManager = new AirportManager(m_ServiceDaoMock, m_CouchbaseDaoMock);
                airportManager.GetAirportInformationByAirportCode(airportCode).ShouldBeEquivalentTo(airportDto);
            }
        }
        public void GetAirportInformationByAirportCodeWhenParamIsNullOrEmpty()
        {
            string airportCode = string.Empty;

            AirportManager airportManager = new AirportManager(m_ServiceDaoMock, m_CouchbaseDaoMock);
            AirportDto actual = airportManager.GetAirportInformationByAirportCode(airportCode);

            Assert.AreEqual(null, actual);
        }
        public void GetAirportInformationFromCouchbaseByAirportCodeWhenParamIsValid()
        {
            Init();
            const string airportCode = "AMS";

            AirportDto airportDto = new AirportDto
            {
                AirportCode = "AMS",
                CityOrAirportName = "Amsterdam",
                Country = "Netherlands",
                CountryCode = "461",
                LatitudeDegree = "52",
                LongitudeDegree = "4"
            };

            m_CouchbaseDaoMock.GetAirportInformationFromCouchbaseByAirportCode(airportCode).Returns(airportDto);

            AirportManager airportManager = new AirportManager(m_ServiceDaoMock, m_CouchbaseDaoMock);
            airportManager.GetAirportInformationFromCouchbaseByAirportCode(airportCode).ShouldBeEquivalentTo(airportDto);

        }
        public void AddAirportInformationToCouchbaseWhenParamIsNull()
        {
            Init();

            AirportDto airportDto = default(AirportDto);

            AirportManager airportManager = new AirportManager(m_ServiceDaoMock, m_CouchbaseDaoMock);
            var actual = airportManager.AddAirportInformationToCouchbase(airportDto);

            Assert.AreEqual(false, actual);
        }
        public void AddAirportInformationToCouchbaseWhenParamIsValid()
        {
            Init();

            AirportDto airportDto = new AirportDto
            {
                AirportCode = "AMS",
                CityOrAirportName = "Amsterdam",
                Country = "Netherlands",
                CountryCode = "461",
                LatitudeDegree = "52",
                LongitudeDegree = "4"
            };

            var expected = m_CouchbaseDaoMock.AddAirportInformationToCouchbase(airportDto);

            AirportManager airportManager = new AirportManager(m_ServiceDaoMock, m_CouchbaseDaoMock);
            var actual = airportManager.AddAirportInformationToCouchbase(airportDto);

            Assert.AreEqual(expected, actual);
        }