Beispiel #1
0
        public void AddProductEntry_ProductEntryAlreadyExists_ThrowException()
        {
            var productEntry = ProductEntryHelperTest.CreateProductEntryExisting();

            var ex = Assert.Throws <RepositoryException>(() => this.repository.Add(productEntry));

            Assert.That(ex.Message, Is.EqualTo("Entrada de produto 'CODE_1' já existe."));
        }
Beispiel #2
0
        public void AddProductEntry_ProductEntryIsValid_GetWorkOrderAdded()
        {
            var productEntry = ProductEntryHelperTest.CreateProductEntryValid();

            this.repository.Add(productEntry);

            var productEntryAdded = this.repository.GetByCode("CODE_2");

            Assert.That(productEntryAdded.Code, Is.EqualTo("CODE_2"));
            Assert.That(productEntryAdded.Supplier.Name, Is.EqualTo("FORNECEDOR_1"));
            Assert.That(productEntryAdded.Product.Description, Is.EqualTo("CAMISA"));
            Assert.That(productEntryAdded.ProductEntryItems.Count, Is.EqualTo(1));
            Assert.That(productEntryAdded.ProductEntryItems[0].Quantity, Is.EqualTo(2));
            Assert.That(productEntryAdded.ProductEntryItems[0].Variation.Gender, Is.EqualTo("FEMININO"));
            Assert.That(productEntryAdded.ProductEntryItems[0].Variation.Color, Is.EqualTo("AZUL"));
            Assert.That(productEntryAdded.ProductEntryItems[0].Variation.Size, Is.EqualTo("M"));
        }