Esempio n. 1
0
        public void CreateAsync_Purschase_Insert_Valid()
        {
            var key = FakeHelper.Key;

            var message = PurchaseMessageMock.Get(key);

            var(dto, proxy) = CreateAsync(message);
            dto.Should().NotBeNull();

            var entity = Db.Orders.FirstOrDefault(x => x.Number == Fake.GetOrderNumber(key));

            entity.Should().NotBeNull();

            var expected = OrderMock.GetByPurchase(key);

            expected.Id          = entity.Id;
            expected.Customer.Id = entity.Customer.Id;
            expected.Items[0].Id = entity.Items[0].Id;

            entity.Should().BeEquivalentToEntity(expected);

            var dtoExpected = ShippingDtoMessageMock.Get(key);

            dtoExpected.OrderId = entity.Id;
            dto.Should().BeEquivalentToMessage(dtoExpected);
        }
Esempio n. 2
0
        public void CreateAsync_Purschase_Insert_IntegrationWithLibrary_Valid()
        {
            var key = FakeHelper.Key;

            var message = PurchaseMessageMock.Get(key);

            var settings = Settings.Empty;

            settings.Preferences.TryAdd(Preferences.IntegrationWithLibrary, "true");

            var(dto, proxy) = CreateAsync(message, settings);
            dto.Should().NotBeNull();

            var entity = Db.Orders.FirstOrDefault(x => x.Number == Fake.GetOrderNumber(key));

            entity.Should().NotBeNull();

            var expected = OrderMock.GetByPurchase(key);

            expected.Id          = entity.Id;
            expected.Customer.Id = entity.Customer.Id;
            expected.Items[0].Id = entity.Items[0].Id;

            entity.Should().BeEquivalentToEntity(expected);

            var dtoExpected = ShippingDtoMessageMock.Get(key);

            dtoExpected.OrderId = entity.Id;
            dto.Should().BeEquivalentToMessage(dtoExpected);

            var proxyExpectd = DropCopyNumberMessageMock.Get(key);

            proxy.Should().BeEquivalentToMessage(proxyExpectd);
        }
Esempio n. 3
0
        public void CreateAsync_Purschase_Update_Customer_NotAccepted()
        {
            var key   = FakeHelper.Key;
            var order = OrderMock.GetByPurchase(key);

            MockRepository.Add(order);

            var message = PurchaseMessageMock.Get(key);
            var key2    = FakeHelper.Key;

            message.CustomerName = Fake.GetCustomerName(key2);
            message.CustomerId   = FakeHelper.GetId(key2).ToString();

            var(dto, proxy) = CreateAsync(message);
            dto.Should().NotBeNull();

            var entity = Db.Orders.FirstOrDefault(x => x.Number == Fake.GetOrderNumber(key));

            entity.Should().NotBeNull();

            var expected = OrderMock.GetByPurchase(key);

            expected.UpdatedAt   = DateTime.UtcNow;
            expected.Items[0].Id = entity.Items[0].Id;
            entity.Should().BeEquivalentToEntity(expected);

            var dtoExpected = ShippingDtoMessageMock.Get(key);

            dtoExpected.OrderId = entity.Id;
            dto.Should().BeEquivalentToMessage(dtoExpected);
        }
Esempio n. 4
0
        public void CreateShippingAsync_Dto_Valid()
        {
            var key = FakeHelper.Key;

            var order = OrderMock.Get(key);

            MockRepository.Add(order);

            var message = ShippingDtoMessageMock.Get(key);

            var dto = CreateShippingAsync(message);

            dto.Should().NotBeNull();

            var dtoExpected = ShippingDtoMock.Get(key);

            dto.Should().BeEquivalentToMessage(dtoExpected);
        }