コード例 #1
0
        public void DataServiceGetAllProductsBySearchParameterShouldReturnOneProduct()
        {
            var d        = new PlusConsultingCodeTest_DataService.ProductDataService();
            var products = d.GetProductsBySearchParameter(x => x.ProductName.Contains("Widget"));

            Assert.AreEqual(1, products.Count);
        }
コード例 #2
0
        public void DataServiceGetAllProductsCountShouldEqualOne()
        {
            var d    = new PlusConsultingCodeTest_DataService.ProductDataService();
            var blah = d.GetAllProducts();

            Assert.IsTrue(blah.Count == 1);
        }
コード例 #3
0
        public void DataServiceAddProductShouldThrowExceptionWithEmptyProduct()
        {
            var       d          = new PlusConsultingCodeTest_DataService.ProductDataService();
            var       newProduct = new Product();
            Exception ex         = null;

            try {
                d.AddProduct(newProduct);
            } catch (Exception e) {
                ex = e;
            }
            Assert.IsNotNull(ex);
        }