Example #1
0
        public void ShouldInsertProductToSql()
        {
            ITriggerAfterChangeProduct triigTriggerAfterChangeProduct = Mock.Create <ITriggerAfterChangeProduct>();

            Mock.Arrange(() => triigTriggerAfterChangeProduct.SendProduct(Arg.IsAny <ChangeInfo>())).DoNothing();
            IProductRepository productRepository = new ProductRepository();

            productRepository.InsertProduct(100, "trang", 100);
        }
Example #2
0
        public void UpdateImageBatch(IEnumerable <ImageProductInfo> imageProductInfos)
        {
            string        pattern      = "Update Product Set ImageId = '{0}', Width = {1}, Height = {2} Where Id = {3}";
            var           productInfos = imageProductInfos as ImageProductInfo[] ?? imageProductInfos.ToArray();
            List <string> str          = productInfos.Select(a => string.Format(pattern, a.ImageId, a.Width, a.Height, a.ProductId)).ToList();

            this._connection.Execute(string.Join(";", str));

            foreach (var variable in productInfos)
            {
                _eventAfterChange.SendProduct(new ChangeInfo(variable.ProductId));
            }
        }