Exemplo n.º 1
0
        public void Construct_ShouldThrowDomainException_WithQuantity_LassThan1()
        {
            var product   = new LookupIdTitle(Guid.NewGuid(), "product", "Koltuk");
            var supplier  = new LookupIdName(Guid.NewGuid(), "supplier");
            var exception = Assert.Throws <DomainException>(() => { new VirtualStockCard(product, supplier, 0); });

            Assert.Equal("Quantity cannot less than 1", exception.Message);
        }
Exemplo n.º 2
0
        public VirtualStockCard(LookupIdTitle product, LookupIdName supplier, double?quantity) : this(product, supplier)
        {
            if (quantity < 1)
            {
                throw new DomainException("Quantity cannot less than 1", new InvalidDataException());
            }

            this.Quantity = quantity;
        }
Exemplo n.º 3
0
        public void Construct_ShouldThrowDomainException_WithProductOrSupplier()
        {
            var product  = new LookupIdTitle(Guid.NewGuid(), "product", "Koltuk");
            var supplier = new LookupIdName(Guid.NewGuid(), "supplier");

            Assert.Throws <DomainException>(() => { new VirtualStockCard(product, null); });
            Assert.Throws <DomainException>(() => { new VirtualStockCard(null, null); });
            Assert.Throws <DomainException>(() => { new VirtualStockCard(null, supplier); });
        }
Exemplo n.º 4
0
        public VirtualStockCard(LookupIdTitle product, LookupIdName supplier)
        {
            if (product == null)
            {
                throw new DomainException($"{nameof(PackageStock)}-{nameof(product)}", new ArgumentNullException());
            }

            if (supplier == null)
            {
                throw new DomainException($"{nameof(PackageStock)}-{nameof(supplier)}", new ArgumentNullException());
            }

            this.Product  = product;
            this.Supplier = supplier;
        }
Exemplo n.º 5
0
 public VirtualStockCard(LookupIdTitle product, LookupIdName supplier, double?quantity, double?threshold) : this(product, supplier, quantity)
 {
     this.Threshold = threshold;
 }