/// <summary>
        /// Method for delete object typeof DefrayalDbModel in repository
        /// </summary>
        /// <param name="modelDefrayal">object typeof DefrayalDbModel</param>
        /// <returns>object DefrayalDbModel after add in repository</returns>
        public DefrayalDbModel AddInDefrayal(DefrayalDbModel modelDefrayal)
        {
            if (modelDefrayal == null)
            {
                throw new ArgumentNullException(Resources.NullModelDefrayal);
            }

            var resultAddDefrayal = this.repositoryDefrayal.Add(modelDefrayal);

            if (resultAddDefrayal == null)
            {
                throw new AddDefrayalException(Resources.InvalidAddOperationDefrayal);
            }

            return(resultAddDefrayal);
        }
        /// <summary>
        /// Method for delete object typeof DefrayalDbModel in repository
        /// </summary>
        /// <param name="modelDefrayal">object typeof DefrayalDbModel</param>
        /// <returns>object DefrayalDbModel after add in repository</returns>
        public async Task <DefrayalDbModel> AddInDefrayalAsync(DefrayalDbModel modelDefrayal)
        {
            if (modelDefrayal == null)
            {
                throw new ArgumentNullException(Resources.NullModelDefrayal);
            }

            var resultAddDefrayal = await this.repositoryDefrayal
                                    .AddAsync(modelDefrayal)
                                    .ConfigureAwait(false);

            if (resultAddDefrayal == null)
            {
                throw new AddDefrayalException(Resources.InvalidAddOperationDefrayal);
            }

            return(resultAddDefrayal);
        }
        public void Add_New_Payment_If_Data_Valid()
        {
            // Object as return in method SetState
            var contentCartDtoInPaid = new ContentCartDto()
            {
                ContentId = 5, StateContent = Common.Enums.CartEnums.StateCartContent.InPaid
            };

            // Setup mockCart
            mockCart.Setup(item => item.SetState(It.IsAny <long>(), It.IsAny <long>(),
                                                 It.Is <MediaShop.Common.Enums.CartEnums.StateCartContent>
                                                     (s => s == MediaShop.Common.Enums.CartEnums.StateCartContent.InPaid ||
                                                     s == MediaShop.Common.Enums.CartEnums.StateCartContent.InCart)))
            .Returns(() => contentCartDtoInPaid);
            mockCart.Setup(item => item.GetCart(It.IsAny <long>()))
            .Returns(() => cart);

            // Object as return in method Add
            var defrayalAddObject = new DefrayalDbModel()
            {
                Id = 0, ContentId = 5
            };

            //Setup mockDefrayal
            mockDefrayal.Setup(item => item.Add(It.IsAny <DefrayalDbModel>()))
            .Returns(() => defrayalAddObject).Callback(() => defrayalAddObject.Id++);

            // Setup mockPayment
            mockPayment.Setup(item => item.Find(It.IsAny <Expression <Func <PayPalPaymentDbModel, bool> > >()))
            .Returns(() => new Collection <PayPalPaymentDbModel>());
            mockPayment.Setup(item => item.Add(It.IsAny <PayPalPaymentDbModel>()))
            .Returns(() => payPalPaymentDbModel).Callback(() => payPalPaymentDbModel.Id++);

            // Create object PayPalService
            var payPalService = new PayPalPaymentService(mockPayment.Object, mockDefrayal.Object, mockCart.Object);

            // Write result method AddPayment in actual1
            var actual1 = payPalService.AddPayment(payment, 1);

            Assert.AreEqual("USD", actual1.Currency);
            Assert.AreEqual(60, actual1.Total);
            Assert.AreEqual(3, actual1.Items.Count);
        }