예제 #1
0
        public void ValidGetUpdatedVendorProductTest()
        {
            var testUpdate = new ProductUpdate
            {
                VendorCode = "TRK",
                ProductId = "00002d4b-224c-49d1-8d6a-ef21ad7111e2"
            };

            VendorProduct result = null;
            Assert.DoesNotThrow(() => result = _testDao.GetUpdatedVendorProduct(testUpdate));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.VendorCode, Is.EqualTo("TRK"));
            Assert.That(result.Description, Is.EqualTo("Cool TRK product"));
        }
예제 #2
0
        public void InvalidGetUpdatedVendorProductTest()
        {
            //Test out an invalid product id
            var invalidProduct1 = new ProductUpdate
            {
                VendorCode = "TRK",
                ProductId = "Test"
            };
            VendorProduct result = null;
            Assert.DoesNotThrow(() => result = _testDao.GetUpdatedVendorProduct(invalidProduct1));
            Assert.That(result, Is.Null);

            //Test out an invalid vendor code
            var invalidProduct2 = new ProductUpdate
            {
                VendorCode = "ZZZ",
                ProductId = "00002d4b-224c-49d1-8d6a-ef21ad7111e2"
            };
            result = null;
            Assert.DoesNotThrow(() => result = _testDao.GetUpdatedVendorProduct(invalidProduct2));
            Assert.That(result, Is.Null);
        }
예제 #3
0
 /// <summary>
 /// Retrieves the updated Vendor Product from the database
 /// </summary>
 /// <param name="update"></param>
 /// <returns>Will return null if the product is not found</returns>
 public VendorProduct GetUpdatedVendorProduct(ProductUpdate update)
 {
     var operation = TableOperation.Retrieve<VendorProduct>(update.VendorCode, update.ProductRowKey);
     return DataSources.VendorData.Execute(operation).Result as VendorProduct;
 }