public void AddProductDifferentPrice() { string doc = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <Root> <Product> <Name>coke</Name> <Price>10</Price> <Ammount>5</Ammount> </Product> <Product> <Name>faxe</Name> <Price>12</Price> <Ammount>10</Ammount> </Product> <Product> <Name>daim</Name> <Price>7</Price> <Ammount>1</Ammount> </Product> </Root>"; StockManager stockMan = new StockManager(XDocument.Parse(doc)); stockMan.AddProduct(new Product("faxe", 9, 1)); }
public void AddProductIncorrectAmountParameter() { string doc = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <Root> <Product> <Name>coke</Name> <Price>10</Price> <Ammount>5</Ammount> </Product> <Product> <Name>faxe</Name> <Price>12</Price> <Ammount>10</Ammount> </Product> <Product> <Name>daim</Name> <Price>7</Price> <Ammount>1</Ammount> </Product> </Root>"; StockManager stockMan = new StockManager(XDocument.Parse(doc)); try { stockMan.AddProduct(new Product("faxe", -9, 12)); Assert.Fail(); } catch (Exception) { } }