public void CheckMissing() { string doc = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <Root> <Product> <Name>coke</Name> <Price>10</Price> <Ammount>5</Ammount> </Product> </Root>"; StockManager stockMan = new StockManager(XDocument.Parse(doc)); bool result = stockMan.CheckAvailability(new Product("nothing")); Assert.AreEqual(false, result); }
public void CheckNull() { string doc = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <Root> <Product> <Name>coke</Name> <Price>10</Price> <Ammount>5</Ammount> </Product> </Root>"; StockManager stockMan = new StockManager(XDocument.Parse(doc)); try { bool result = stockMan.CheckAvailability(null); Assert.Fail(); } catch (Exception) { } }