Example #1
0
        public async Task VesselPositions_InCustomArea_InvalidApiKey()
        {
            var client  = new MarineTrafficApiClient("no-api-key");
            var request = ExportVesselsV8Request.VesselPositions().InCustomArea(0.1, 0.2, 1.5, 1.6);
            var result  = await request.Execute(client);

            LocalTests.VerifyFailed(result);
            Assert.AreEqual(1, result.Errors.Count);
            Assert.AreEqual("10", result.Errors[0].Code);
            Assert.AreEqual(MarineTrafficErrorCode.ServiceKeyNotFound, result.Errors[0].KnownCode);
        }
Example #2
0
        public async Task VesselPositions_InCustomArea_NoApiKey()
        {
            var client  = new MarineTrafficApiClient(null);
            var request = ExportVesselsV8Request.VesselPositions().InCustomArea(0.1, 0.2, 1.5, 1.6);
            var result  = await request.Execute(client);

            LocalTests.VerifyFailed(result);
            Assert.AreEqual(1, result.Errors.Count);
            Assert.AreEqual("1", result.Errors[0].Code);
            Assert.AreEqual(MarineTrafficErrorCode.IncorrectCallCheckParameters, result.Errors[0].KnownCode);
        }
Example #3
0
        public async Task VesselPositions_InCustomAreaBastia_OkApiKey()
        {
            if (LocalTests.LocalApiKey == null)
            {
                Assert.Inconclusive("Please set you API key. ");
            }

            var client  = new MarineTrafficApiClient(LocalTests.LocalApiKey);
            var request = ExportVesselsV8Request.VesselPositions().InCustomArea(42.6748, 42.7193, 009.4116, 009.4994);

            request.MessageType = ExportVesselsMessageType.Extended;
            request.Timespan    = 60;
            var result = await request.Execute(client);

            LocalTests.VerifySucceed(result);
        }
Example #4
0
        public async Task VesselPositions_InCustomArea_OkApiKey()
        {
            if (LocalTests.LocalApiKey == null)
            {
                Assert.Inconclusive("Please set you API key. ");
            }

            var client  = new MarineTrafficApiClient(LocalTests.LocalApiKey);
            var request = ExportVesselsV8Request.VesselPositions().InCustomArea(27.4950, 27.5824, 052.4975, 052.6310);

            ////request.MessageType = ExportVesselsMessageType.Extended;
            request.Timespan = 60;
            var result = await request.Execute(client);

            LocalTests.VerifySucceed(result);
        }