Exemplo n.º 1
0
        public void InMemoryProductRepository_should_add_the_given_product()
        {
            var testCokeProduct = _fixture.Create <Product>();
            var cut             = new InMemoryProductRepository();

            cut.AddProduct(testCokeProduct);
            var actual = cut.GetProductByProductCode(testCokeProduct.ProductCode);

            actual.Should().NotBeNull();
            actual.Should().Be(testCokeProduct);
        }
Exemplo n.º 2
0
        public void InMemoryProductRepository_should_throw_the_Argument_Exception_When_Price_Is_negative_or_zero(decimal price)
        {
            var testProduct = _fixture.Create <Product>();

            void Action()
            {
                var cut = new InMemoryProductRepository();

                testProduct.Price = price;

                cut.AddProduct(testProduct);
            }

            Assert.Throws <ArgumentException>((Action)Action);
        }
Exemplo n.º 3
0
        public void InMemoryProductRepository_should_throw_the_Argument_Exception_When_Quantity_Is_negative_or_zero(int quantity)
        {
            var testProduct = _fixture.Create <Product>();

            void Action()
            {
                var cut = new InMemoryProductRepository();

                testProduct.Quantity = quantity;

                cut.AddProduct(testProduct);
            }

            Assert.Throws <ArgumentException>((Action)Action);
        }
Exemplo n.º 4
0
        public void InMemoryProductRepository_should_throw_the_Argument_Exception_When_description_Is_Null_or_empty(string description)
        {
            var testProduct = _fixture.Create <Product>();

            void Action()
            {
                var cut = new InMemoryProductRepository();

                testProduct.Description = description;

                cut.AddProduct(testProduct);
            }

            Assert.Throws <ArgumentException>((Action)Action);
        }