public void FilledOrderTest()
        {
            var sourceOrder = MocksProvider.GetFilledOrderMock();
            var targetOrder = connector.Convert <Order, OrderDto>(sourceOrder);

            Assert.IsNotNull(targetOrder);
            Assert.IsNotNull(sourceOrder.products);
            Assert.AreEqual(2, targetOrder.Products.Length);
        }
        public void ProductTest()
        {
            var sourceProduct = MocksProvider.GetProductMock();
            var targetProduct = connector.Convert <Product, ProductDto>(sourceProduct);

            Assert.IsNotNull(targetProduct);
            Assert.AreEqual(sourceProduct.name, targetProduct.Name);
            Assert.AreEqual(sourceProduct.quantity, targetProduct.Quantity);
        }
        public void EmptyOrderTest()
        {
            var sourceOrder = MocksProvider.GetEmptyOrderMock();
            var targetOrder = connector.Convert <Order, OrderDto>(sourceOrder);

            Assert.IsNotNull(targetOrder);
            Assert.AreEqual(sourceOrder.order_id, targetOrder.Id);
            Assert.AreEqual(sourceOrder.date_add, targetOrder.DateAdd);
            Assert.IsNull(sourceOrder.products);
        }
Exemplo n.º 4
0
        public static void Initialize(TestContext context)
        {
            var sourceMock = new Mock <ISourceConnector>();

            sourceMock.Setup(m => m.GetOrder(It.IsAny <int>()))
            .Returns(Task.FromResult(MocksProvider.GetEmptyOrderDtoMock()));
            var targetMock = new Mock <ITargetConnector>();

            targetMock.Setup(m => m.SubmitOrder(It.IsAny <OrderDto>()))
            .Returns(Task.FromResult(true));
            migrator = new MigratorService(sourceMock.Object, targetMock.Object);
        }