public CompactDisk(string bandname, string diskname, string asin, myPrice price) { if (string.IsNullOrWhiteSpace (bandname)) throw new ArgumentException ("You've to add a bandname to CDs."); if (string.IsNullOrWhiteSpace (diskname)) throw new ArgumentException ("You've to add the title of the disk."); if (string.IsNullOrWhiteSpace (asin)) throw new ArgumentException ("ASIN mustn't be empty."); Bandname = bandname; Diskname = diskname; ASIN = asin; UpdatePrice (price.Amount,price.Unit); }
public void CanCreatePrice() { var x = new myPrice(1, Currency.EUR); Assert.IsTrue(x.Amount == 1); Assert.IsTrue(x.Unit == Currency.EUR); }
public void UpdatePrice(decimal newprice, Currency curr) { if (newprice < 0) throw new ArgumentException ("Price must not be negative."); actualprice = new myPrice(newprice, curr); }