예제 #1
0
        public void RegisterOrderCollectRequest()
        {
            var client     = new MandaeClient("0b5e2c6410cf0ac087ae7ace111dbd42");
            var orderModel = MockOrdersRepository.GetSampleOrderModel();
            var order      = client.CreateOrderCollectRequest(orderModel);

            Assert.IsNull(order.Error);
            Assert.IsTrue(order.Id > 0);
            Assert.IsTrue(order.Items.First().Id > 0);
        }
예제 #2
0
        public async Task RegisterOrderCollectRequestAsync()
        {
            var client     = new MandaeClient("0b5e2c6410cf0ac087ae7ace111dbd42");
            var source     = new CancellationTokenSource(new TimeSpan(0, 5, 0));
            var orderModel = MockOrdersRepository.GetSampleOrderModel();
            var order      = await client.CreateOrderCollectRequestAsync(orderModel, source.Token);

            Assert.IsNull(order.Error);
            Assert.IsTrue(order.Id > 0);
            Assert.IsTrue(order.Items.First().Id > 0);
        }
예제 #3
0
        public void GetTracking()
        {
            var client     = new MandaeClient("0b5e2c6410cf0ac087ae7ace111dbd42");
            var orderModel = MockOrdersRepository.GetSampleOrderModel();
            var order      = client.CreateOrderCollectRequest(orderModel);

            Assert.IsNull(order.Error);
            Assert.IsTrue(order.Id > 0);
            Assert.IsTrue(order.Items.First().Id > 0);
            var tracking = client.GetTracking(orderModel.Items.First().TrackingId);

            Assert.IsNull(tracking.Error);
            Assert.AreEqual(orderModel.Items.First().TrackingId, tracking.TrackingCode);
            Assert.AreEqual("Indefinido", tracking.CarrierName);
            Assert.IsNull(tracking.CarrierCode);
            Assert.IsTrue(tracking.Events.Any());
            var firstEvent = tracking.Events.Single();

            Assert.IsNull(firstEvent.Name);
            Assert.AreEqual("Nenhuma atualização disponível ainda.", firstEvent.Description);
        }
예제 #4
0
        public async Task GetTrackingAsync()
        {
            var client     = new MandaeClient("0b5e2c6410cf0ac087ae7ace111dbd42");
            var source     = new CancellationTokenSource(new TimeSpan(0, 5, 0));
            var orderModel = MockOrdersRepository.GetSampleOrderModel();
            var order      = await client.CreateOrderCollectRequestAsync(orderModel, source.Token);

            Assert.IsNull(order.Error);
            Assert.IsTrue(order.Id > 0);
            Assert.IsTrue(order.Items.First().Id > 0);
            var tracking = await client.GetTrackingAsync(orderModel.Items.First().TrackingId, source.Token);

            Assert.IsNull(tracking.Error);
            Assert.AreEqual(orderModel.Items.First().TrackingId, tracking.TrackingCode);
            Assert.AreEqual("Indefinido", tracking.CarrierName);
            Assert.IsNull(tracking.CarrierCode);
            Assert.IsTrue(tracking.Events.Any());
            var firstEvent = tracking.Events.Single();

            Assert.IsNull(firstEvent.Name);
            Assert.AreEqual("Nenhuma atualização disponível ainda.", firstEvent.Description);
        }