Example #1
0
        public void Deserialize_OpenSkyResponse_GetState_00()
        {
            string json     = @"{'time':1526079430,'states':[['ab1644','','United States',1526079426,1526079429,-87.8424,42.0282,1013.46,false,118.95,36.03,9.75,null,944.88,'5373',false,0],['ac96b8','AAL2441 ','United States',1526079429,1526079429,-84.9193,35.5556,11277.6,false,224.61,292.63,0,null,11711.94,'1640',true,0]]}";
            string expected = "ab1644";

            var osr = PlaneService.Deserialize(json);

            Assert.Equal(osr.GetState(0, 0), expected);
        }
Example #2
0
        public void Deserialize_ReturnsOpenSkyResponse_Time()
        {
            // Arrange
            string json     = @"{'time':1526079430,'states':[['ab1644','','United States',1526079426,1526079429,-87.8424,42.0282,1013.46,false,118.95,36.03,9.75,null,944.88,'5373',false,0]]}";
            int    expected = 1526079430;

            // Act
            var actual = PlaneService.Deserialize(json);

            // Assert
            Assert.Equal(actual.Time, expected);
        }
Example #3
0
        public void Deserialize_OpenSkyResponse_Finds_First_ICAO()
        {
            // Arrange
            string json     = @"{'time':1526079430,'states':[['ab1644','','United States',1526079426,1526079429,-87.8424,42.0282,1013.46,false,118.95,36.03,9.75,null,944.88,'5373',false,0],['ac96b8','AAL2441 ','United States',1526079429,1526079429,-84.9193,35.5556,11277.6,false,224.61,292.63,0,null,11711.94,'1640',true,0]]}";
            string expected = "ab1644";

            // Act
            var    osr    = PlaneService.Deserialize(json);
            string actual = osr.GetIcao24(0);

            // Assert
            Assert.Equal(expected, actual);
        }
Example #4
0
        public void Deserialize_OpenSkyResponse_Finds_First_Origin_Country()
        {
            // Arrange

            string json     = @"{'time':1526079430,'states':[['ab1644','','United States',1526079426,1526079429,-87.8424,42.0282,1013.46,false,118.95,36.03,9.75,null,944.88,'5373',false,0]]}";
            string expected = "United States";

            // Act
            var    osr    = PlaneService.Deserialize(json);
            string actual = osr.GetOriginCountry(0);

            // Assert
            Assert.Equal(actual, expected);
        }
Example #5
0
        public void OpenSkyRepsonse_StateCount(int expected, string data)
        {
            var osr = PlaneService.Deserialize(data);

            Assert.Equal(expected, osr.StateCount);
        }