示例#1
0
        public async Task Execution_deletes_order_and_associated_order_items_state_based_async()
        {
            var order = new Order()
            {
                OrderDate = DateTime.Now
            };
            var orderRepo = new OrderRepository(Mock.Of <ICustomerDataProxy>(), Mock.Of <IOrderItemDataProxy>());

            orderRepo.Clear();
            order = orderRepo.Insert(order);
            var orderItemRepo = new OrderItemRepository();

            orderItemRepo.Clear();
            await orderItemRepo.InsertAsync(new OrderItem { OrderID = order.ID, OrderStatusID = OrderStatusConstants.PENDING_STATUS });

            await orderItemRepo.InsertAsync(new OrderItem { OrderID = order.ID, OrderStatusID = OrderStatusConstants.SUBMITTED_STATUS });

            await orderItemRepo.InsertAsync(new OrderItem { OrderID = order.ID, OrderStatusID = OrderStatusConstants.BACK_ORDERED_STATE });

            await orderItemRepo.InsertAsync(new OrderItem { OrderID = 2, OrderStatusID = OrderStatusConstants.PENDING_STATUS });

            var orderItemService = new OrderItemService(orderItemRepo, Mock.Of <IProductDataProxy>(), Mock.Of <IInventoryItemDataProxy>(), new TransactionContextStub());

            var command = new DeleteOrderCommand(order.ID, orderRepo, orderItemService, new TransactionContextStub());
            await command.ExecuteAsync();

            orderRepo.GetAll().ShouldBeEmpty();
            orderItemRepo.GetAll().Count().ShouldBe(1);
        }
示例#2
0
 public UnitOfWork(CoffeeShopContext context)
 {
     _context   = context;
     Offices    = new OfficeRepository(_context);
     Products   = new ProductRepository(_context);
     OrderItems = new OrderItemRepository(_context);
 }
示例#3
0
        public async Task Execution_should_fail_when_order_is_associated_with_items_that_have_been_shipped_state_based_async()
        {
            var order = new Order()
            {
                OrderDate = DateTime.Now
            };
            var orderRepo = new OrderRepository(Mock.Of <ICustomerDataProxy>(), Mock.Of <IOrderItemDataProxy>());

            orderRepo.Clear();
            order = await orderRepo.InsertAsync(order);

            var orderItemRepo = new OrderItemRepository();

            orderItemRepo.Clear();
            await orderItemRepo.InsertAsync(new OrderItem()
            {
                OrderID = order.ID, OrderStatusID = OrderStatusConstants.PENDING_STATUS
            });

            2.Times(async() => await orderItemRepo.InsertAsync(new OrderItem()
            {
                OrderID = order.ID, OrderStatusID = OrderStatusConstants.SHIPPED_STATUS
            }));
            var orderItemService = new OrderItemService(orderItemRepo, Mock.Of <IProductDataProxy>(), Mock.Of <IInventoryItemDataProxy>(), Mock.Of <ITransactionContext>());

            var command = new DeleteOrderCommand(order.ID, orderRepo, orderItemService, new TransactionContextStub());
            var result  = await command.ExecuteAsync();

            result.Success.ShouldBe(false);
            result.Errors.Count().ShouldBe(2);
        }
        public void AddItems_GivenAListOfNewItems_AddsThemToDatabase()
        {
            // arrange
            List <OrderItem> items = new List <OrderItem>();

            items.Add(new OrderItem()
            {
                ID = 30
            });
            items.Add(new OrderItem()
            {
                ID = 31
            });
            items.Add(new OrderItem()
            {
                ID = 32
            });
            items.Add(new OrderItem()
            {
                ID = 33
            });
            Mock <DbSet <OrderItem> > mockSet     = new Mock <DbSet <OrderItem> >();
            Mock <OrderDb>            mockContext = new Mock <OrderDb>();

            mockContext.Setup(c => c.OrderItems).Returns(mockSet.Object);
            OrderItemRepository sut = new OrderItemRepository(mockContext.Object);

            // act
            sut.AddItems(items);

            // assert
            mockSet.Verify(s => s.AddRange(It.Is <IEnumerable <OrderItem> >(l => l.Count() == 4)), Times.Once());
            mockContext.Verify(c => c.SaveChanges(), Times.Once());
        }
示例#5
0
 protected override void DoLoadLine(ArrayList dataRow)
 {
     ShipMethod = (string)dataRow[0];
     Customer   = new Customer((int)dataRow[1]);
     _items     = new Lazy <List <OrderItem> >(() => OrderItemRepository.ListForOrder(Id)
                                               .ToList());
 }
示例#6
0
        public JsonResult PerformOrder()
        {
            try
            {
                if (TempData["CartHasItems"] != null)
                {
                    Cart currentCart = (Cart)TempData["CurrentCart"];

                    List <DTOOrderItem> orderItems = currentCart.EntityList.Select(x => new DTOOrderItem()
                    {
                        ItemId = x.ItemId,
                        Qty    = x.Qty
                    }).ToList();

                    int orderId = new OrderRepository().CreateOrder();

                    List <int> subOrderIds = new SubOrderRepository().Create(orderItems, orderId);

                    List <int> orderItemIds = new OrderItemRepository().CreateOrderItems(orderItems, orderId);
                }
                else
                {
                    return(Json(new { success = false, message = "Cart is empty." }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false }));
            }

            TempData["CartHasItems"] = null;
            TempData["CurrentCart"]  = null;
            return(Json(new { success = true }));
        }
示例#7
0
        public void GetProductRepositoryTestIsCalled()
        {
            //Arrange
            MainWindow windowTest = new MainWindow();
            var MockNotificationSvc = new Mock<INotificationService>();
            var MockPaymentProcessor = new Mock<IPaymentProcessor>();
            var MockProductRepo = new Mock<IProductRepository>();
            OrderItemRepository orderRepo = new OrderItemRepository();
            Cart ActiveCart = new Cart(orderRepo);

            List<Product> catalogProducts = new List<Product>()
            {
                new Product(){Name = "cable", OnHand = 5},
                new Product(){Name = "charger", OnHand = 4},
                new Product() {Name = "battery", OnHand = 3}
            };

            MockProductRepo.Setup(x => x.GetProducts()).Returns(catalogProducts);

            //Act
            windowTest.ListProductsInCatalog(MockProductRepo.Object);

            Assert.AreEqual(true, windowTest.lstSelection.Items.Contains("cable"));
            MockProductRepo.Verify(x => x.GetProducts());
        }
示例#8
0
        public void SavingTest()
        {
            //Arrange
            OrderItemRepository orderItemRepository = new OrderItemRepository();

            //Assert
            Assert.IsTrue(orderItemRepository.Save());
        }
示例#9
0
 public NorthwindUnitOfWork(string connectionString)
 {
     Customers  = new CustomerRepository(connectionString);
     OrderItems = new OrderItemRepository(connectionString);
     Orders     = new OrderRepository(connectionString);
     Products   = new ProductRepository(connectionString);
     Suppliers  = new SupplierRepository(connectionString);
     Users      = new UserRepository(connectionString);
 }
示例#10
0
        public ActionResult DeleteItem(int id)
        {
            JsonResult          result        = new JsonResult();
            OrderItemRepository orderItemRepo = new OrderItemRepository(applicationCache);
            var             model             = orderItemRepo.Get(id);
            OrderRepository orderRepo         = new OrderRepository(false, loggedInUser.Id, applicationCache);

            result.Data = orderItemRepo.Delete(model);
            return(result);
        }
示例#11
0
        public void retrieveOrderItemTest()
        {
            //Arrange
            OrderItemRepository orderItemRepository = new OrderItemRepository();
            var expected = new OrderItem(0);

            //Assert
            //if you compare the 2 objects you'll get a wrong output because they don't refer the same object
            //you have to comapre each property
            Assert.AreEqual(orderItemRepository.retrieve(0).OrderItemID, expected.OrderItemID);
        }
 public UnitOfWork()
 {
     Category    = new CategoryRepository(context);
     Product     = new ProductRepository(context);
     Designation = new DesignationRepository(context);
     Employee    = new EmployeeRepository(context);
     User        = new UserRepository(context);
     OrderInfo   = new OrderRepository(context);
     Order       = new OrderItemRepository(context);
     Delivery    = new DeliveryRepository(context);
     UserAccess  = new UserAccessRepository(context);
 }
示例#13
0
        public UnitOfWork(OnlineStoreContext context)
        {
            _context = context;

            UserAddress = new UserAddressRepository(_context);
            Products    = new ProductRepository(_context);

            Orders     = new OrderRepository(_context);
            OrderItems = new OrderItemRepository(_context);

            ShoppingCarts     = new ShoppingCartRepository(_context);
            ShoppingCartItems = new ShoppingCartItemRepository(_context);
        }
示例#14
0
 public UnitOfWork()
 {
     Client              = new ClientRepository(_context);
     Order               = new OrderRepository(_context);
     OrderItem           = new OrderItemRepository(_context);
     Pet                 = new PetRepository(_context);
     Product             = new ProductRepository(_context);
     Promotion           = new PromotionRepository(_context);
     Service             = new ServiceRepository(_context);
     ServicePriceHistory = new ServicePriceHistoryRepository(_context);
     ServiceSchedule     = new ServiceScheduleRepository(_context);
     User                = new UserRepository(_context);
     UserAvaliation      = new UserAvaliationRepository(_context);
 }
示例#15
0
文件: BLLTest.cs 项目: mueller04/Cart
        public void WhenAddIsCalledOnHandDecrements()
        {
            var orderItemRepo = new OrderItemRepository();
            List<Product> catalogProducts = new List<Product>()
            {
                new Product(){Name = "cable", OnHand = 5},
                new Product(){Name = "charger", OnHand = 4},
                new Product() {Name = "battery", OnHand = 3}
            };

            //Act
            var message = orderItemRepo.Add("battery", 2, catalogProducts);

            //Assert
            Assert.AreEqual(1, catalogProducts[2].OnHand);
        }
示例#16
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var productsDataProxy  = new ProductRepository();
            var inventoryDataProxy = new InventoryItemRepository();
            var customerDataProxy  = new CustomerRepository();
            var orderItemDataProxy = new OrderItemRepository();
            var orderRepository    = new OrderRepository(customerDataProxy, orderItemDataProxy);

            _inventoryService  = new InventoryItemService(inventoryDataProxy);
            _orderItemsService = new OrderItemService(orderItemDataProxy, productsDataProxy, inventoryDataProxy, new DTCTransactionContext());
            _ordersService     = new OrderService(orderRepository, _orderItemsService, new DTCTransactionContext());
            _customersService  = new CustomerService(customerDataProxy, _ordersService);
            _productsService   = new ProductService(productsDataProxy, _ordersService, _inventoryService, new DTCTransactionContext());
            _categoriesService = new CategoryService(new CategoryRepository(), productsDataProxy);
            this.DataContext   = new MainWindowVM(_eventAggregator, _customersService, _productsService, _categoriesService, _ordersService, _inventoryService);
        }
示例#17
0
        public ActionResult AddItems(IEnumerable <OrderItemModel> orderItems)
        {
            JsonResult          result        = new JsonResult();
            OrderItemRepository orderItemRepo = new OrderItemRepository(applicationCache);
            OrderRepository     orderRepo     = new OrderRepository(false, loggedInUser.Id, applicationCache);
            int orderId;

            orderItemRepo.SaveOrderItems(orderItems, out orderId);
            var order = orderRepo.Get(orderId);

            order.InProgress = true;
            order.Delivered  = false;
            orderRepo.Save(order);
            result.Data = orderRepo.Get(orderId);
            return(result);
        }
        //public CategoryRepository CategoryRepository { get; private set; }

        public InventoryUnitOfWork(InventoryContext context)
        {
            _context              = context;
            BillOrderRepository   = new BillOrderRepository(_context);
            BillRepository        = new BillRepository(_context);
            ClientRepository      = new ClientRepository(_context);
            ItemRepository        = new ItemRepository(_context);
            ItemSetItemRepository = new ItemSetItemRepository(_context);
            ItemSetRepository     = new ItemSetRepository(_context);
            OrderItemRepository   = new OrderItemRepository(_context);
            OrderItemRepository   = new OrderItemRepository(_context);
            StockInRepository     = new StockInRepository(_context);
            StockOutRepository    = new StockOutRepository(_context);
            StockRepository       = new StockRepository(_context);
            //CategoryRepository = new CategoryRepository(_context);
        }
示例#19
0
 private void ConfigureInMemoryUsage()
 {
     var productsDataProxy = new ProductRepository();
     var inventoryDataProxy = new InventoryItemRepository();
     var customerDataProxy = new CustomerRepository();
     var orderItemDataProxy = new OrderItemRepository();
     var orderRepository = new OrderRepository(customerDataProxy, orderItemDataProxy);
     var categoriesDataProxy = new CategoryRepository();
     _inventoryService = new InventoryItemService(inventoryDataProxy);
     _orderItemsService = new OrderItemService(orderItemDataProxy, productsDataProxy, inventoryDataProxy, new DTCTransactionContext());
     _ordersService = new OrderService(orderRepository, _orderItemsService, new DTCTransactionContext());
     _customersService = new CustomerService(customerDataProxy, _ordersService);
     _productsService = new ProductService(productsDataProxy, orderRepository, _inventoryService, new DTCTransactionContext());
     _categoriesService = new CategoryService(categoriesDataProxy, productsDataProxy);
     this.DataContext = new MainWindowVM(_eventAggregator, _customersService, _productsService, _categoriesService, _ordersService, _inventoryService);
 }
示例#20
0
        public UnitOfWork(ICCEntities _context)
        {
            context     = _context;
            UserAcount  = new UserAcountRepository(_context);
            UserRole    = new UserRoleRepository(_context);
            Role        = new RoleRepository(_context);
            OrderItem   = new OrderItemRepository(_context);
            Membership  = new MembershipRepository(_context);
            Machine     = new MachineRepository(_context);
            Item        = new ItemRepository(_context);
            Facility    = new FacilityRepository(_context);
            BuyFacility = new BuyFacilityRepository(_context);
            BookMachine = new BookMachineRepository(_context);

            // UserAcounts = new UserAcountRepository(userAcount);
        }
示例#21
0
        public GraphQLQueries(OrderRepository orderRepository,
                              OrderItemRepository orderItemRepository)
        {

            #region Order

            Field<ListGraphType<OrderType>>(
               "orders",
               resolve: context => orderRepository.GetAll());

            Field<OrderType>(
                "order",
                arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>>
                { Name = "id" }),
                resolve: context =>
                {
                    var id = context.GetArgument<int>("id");
                    return orderRepository.GetOne(id);

                });


            #endregion


            #region OrderItems

            Field<ListGraphType<OrderItemType>>(
                "orderItems",
                resolve: context => orderItemRepository.GetAll());

            Field<OrderItemType>(
                "orderItemsForOrder",
                arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>>
                { Name = "id" }),
                resolve: context =>
                {
                    var id = context.GetArgument<int>("id");
                    return orderItemRepository.GetForOrder(id);

                });



            #endregion

        }
        public void GetItemsByOrder_GivenAValidOrderID_ReturnsTheListOfItemsForThatOrder()
        {
            // arrange
            List <OrderItem> data = new List <OrderItem>();

            data.Add(new OrderItem()
            {
                ID = 30, OrderID = 10
            });
            data.Add(new OrderItem()
            {
                ID = 31, OrderID = 11
            });
            data.Add(new OrderItem()
            {
                ID = 32, OrderID = 11
            });
            data.Add(new OrderItem()
            {
                ID = 33, OrderID = 11
            });
            data.Add(new OrderItem()
            {
                ID = 34, OrderID = 12
            });
            data.Add(new OrderItem()
            {
                ID = 35, OrderID = 12
            });
            List <OrderItem> expected = new List <OrderItem>();

            expected.Add(data[1]);
            expected.Add(data[2]);
            expected.Add(data[3]);
            Mock <DbSet <OrderItem> > mockSet     = EntityMockFactory.CreateSet(data.AsQueryable());
            Mock <OrderDb>            mockContext = new Mock <OrderDb>();

            mockContext.Setup(c => c.OrderItems).Returns(mockSet.Object);
            OrderItemRepository sut = new OrderItemRepository(mockContext.Object);

            // act
            var actual = sut.GetItemsByOrder(11);

            // assert
            Assert.IsTrue(Equality.AreEqual(expected, actual));
        }
示例#23
0
        private void ConfigureInMemoryUsage()
        {
            var productsDataProxy   = new ProductRepository();
            var inventoryDataProxy  = new InventoryItemRepository();
            var customerDataProxy   = new CustomerRepository();
            var orderItemDataProxy  = new OrderItemRepository();
            var orderRepository     = new OrderRepository(customerDataProxy, orderItemDataProxy);
            var categoriesDataProxy = new CategoryRepository();

            _inventoryService  = new InventoryItemService(inventoryDataProxy);
            _orderItemsService = new OrderItemService(orderItemDataProxy, productsDataProxy, inventoryDataProxy, new DTCTransactionContext());
            _ordersService     = new OrderService(orderRepository, _orderItemsService, new DTCTransactionContext());
            _customersService  = new CustomerService(customerDataProxy, _ordersService);
            _productsService   = new ProductService(productsDataProxy, orderRepository, _inventoryService, new DTCTransactionContext());
            _categoriesService = new CategoryService(categoriesDataProxy, productsDataProxy);
            this.DataContext   = new MainWindowVM(_eventAggregator, _customersService, _productsService, _categoriesService, _ordersService, _inventoryService);
        }
示例#24
0
        public OrderType(OrderItemRepository orderItemRepository, IDataLoaderContextAccessor dataLoaderAccessor)
        {
            Field(t => t.Id);
            Field(t => t.OrderDate);
            Field(t => t.OrderNumber);
            Field(t => t.TotalAmount);

            Field <ListGraphType <OrderItemType> >(
                "orderItems",
                resolve: context =>
            {
                var loader =
                    dataLoaderAccessor.Context.GetOrAddCollectionBatchLoader <int, OrderItem>(
                        "GetOrderItemsByOrderId", orderItemRepository.GetForOrders);
                return(loader.LoadAsync(context.Source.Id));
            });
        }
示例#25
0
文件: BLLTest.cs 项目: mueller04/Cart
        public void WhenAddIsCalledNotEnoughInventoryCausesStringReturn()
        {
            //Arrange
            //var mockOrderItemRepo = new Mock<IOrderItemRepository>();
            var orderItemRepo = new OrderItemRepository();
            List<Product> catalogProducts = new List<Product>()
            {
                new Product(){Name = "cable", OnHand = 5},
                new Product(){Name = "charger", OnHand = 4},
                new Product() {Name = "battery", OnHand = 3}
            };

            //Act
            var message = orderItemRepo.Add("battery", 4, catalogProducts);

            //Assert
            Assert.AreEqual("Not enough inventory.", message);
        }
示例#26
0
        public ProductType(OrderItemRepository orderItemRepository, IDataLoaderContextAccessor dataLoaderAccessor)
        {
            Field(t => t.Id);
            Field(t => t.ProductName);
            Field(t => t.UnitPrice);
            Field(t => t.Package);
            Field(t => t.IsDiscontinued);

            Field <ListGraphType <OrderItemType> >(
                "orderItems",
                resolve: context =>
            {
                var loader =
                    dataLoaderAccessor.Context.GetOrAddCollectionBatchLoader <int, OrderItem>(
                        "GetOrderItemsByProductId", orderItemRepository.GetForProducts);
                return(loader.LoadAsync(context.Source.Id));
            });
        }
        public void AddItem_GivenANewItem_AddsToDatabase()
        {
            // arrange
            OrderItem item = new OrderItem()
            {
                ID = 23
            };
            Mock <DbSet <OrderItem> > mockSet     = new Mock <DbSet <OrderItem> >();
            Mock <OrderDb>            mockContext = new Mock <OrderDb>();

            mockContext.Setup(c => c.OrderItems).Returns(mockSet.Object);
            OrderItemRepository sut = new OrderItemRepository(mockContext.Object);

            // act
            sut.AddItem(item);

            // assert
            mockSet.Verify(s => s.Add(It.Is <OrderItem>(oi => oi.ID == 23)), Times.Once());
            mockContext.Verify(c => c.SaveChanges(), Times.Once());
        }
示例#28
0
文件: BLLTest.cs 项目: mueller04/Cart
        public void WhenAddisCalledOnOnlyOneTypeofItemItRestrictsAddPerTheRightOnHand()
        {
            var orderItemRepo = new OrderItemRepository();
            List<Product> catalogProducts = new List<Product>()
            {
                new Product(){Name = "cable", OnHand = 5},
                new Product(){Name = "charger", OnHand = 4},
                new Product() {Name = "battery", OnHand = 3}
            };

            //Act

            var message = orderItemRepo.Add("battery", 1, catalogProducts);
            var messagetwo = orderItemRepo.Add("battery", 1, catalogProducts);
            var messagethree = orderItemRepo.Add("battery", 1, catalogProducts);
            var messagefour = orderItemRepo.Add("battery", 1, catalogProducts);

            //Assert
            Assert.AreEqual(0, catalogProducts[2].OnHand);
            Assert.AreEqual("Not enough inventory.", messagefour);
        }
        private void Dispose(bool dispose)
        {
            if (dispose)
            {
                if (_userRepository != null)
                {
                    //_connection.Dispose();
                    _userRepository = null;
                }
                if (_productRepository != null)
                {
                    //_connection.Dispose();
                    _productRepository = null;
                }

                if (_orderRepository != null)
                {
                    //_connection.Dispose();
                    _orderRepository = null;
                }

                if (_orderItemRepository != null)
                {
                    //_connection.Dispose();
                    _orderItemRepository = null;
                }

                if (_commentRepository != null)
                {
                    //_connection.Dispose();
                    _commentRepository = null;
                }

                if (_categoryRepository != null)
                {
                    //_connection.Dispose();
                    _categoryRepository = null;
                }
            }
        }
示例#30
0
        public void CreateOrderFromConsignment_ValidConsignment_OrderCreated()
        {
            var dispatcher     = MockRepository.GenerateMock <IQueueDispatcher <IMessage> >();
            var userRepository = new UserAccountRepository();
            var user           = userRepository.GetByEmail("*****@*****.**", false);
            var userContext    = new TestUserContext(user);

            var orderRepository          = new OrderRepository();
            var orderItemRepository      = new OrderItemRepository();
            var supplierRepository       = new SupplierRepository();
            var listItemRepository       = new ListItemRepository();
            var currencyRepository       = new CurrencyRepository();
            var entityIdProvider         = new DirectEntityIdProvider();
            var jobItemRepository        = new JobItemRepository();
            var companyDetailsRepository = new CompanyDetailsRepository();
            var consignmentRepository    = new ConsignmentRepository();

            var supplierId    = Guid.NewGuid();
            var jobId         = Guid.NewGuid();
            var jobItem1Id    = Guid.NewGuid();
            var jobItem2Id    = Guid.NewGuid();
            var jobItem3Id    = Guid.NewGuid();
            var consignmentId = Guid.NewGuid();

            CreateOrderFromConsignmentHelper.CreateContextForCreateOrderFromConsignmentTest(jobId, supplierId, consignmentId, jobItem1Id, jobItem2Id, jobItem3Id);
            var orderItemService = new OrderItemService(userContext, orderRepository, orderItemRepository, supplierRepository, jobItemRepository, listItemRepository, dispatcher);
            var orderService     = new OrderService(
                userContext, orderRepository, consignmentRepository, supplierRepository, currencyRepository, entityIdProvider,
                orderItemService, companyDetailsRepository, dispatcher);
            var orderId = orderService.CreateOrderFromConsignment(consignmentId);
            var order   = orderService.GetById(orderId);

            Assert.AreEqual(supplierId, order.Supplier.Id);
            var orderItems = orderItemService.GetOrderItems(orderId).OrderBy(o => o.ItemNo).ToList();

            Assert.AreEqual(3, orderItems.Count);
            Assert.AreEqual(ListItemType.StatusItemWithSubContractor, orderItems[0].JobItem.Status.Type);
            Assert.AreEqual("Druck, DPI601IS, Digital Pressure Indicator", orderItems[0].Description);
        }
        public void RemoveItem_GivenAValidID_DeletesTheRecordFromDatabase()
        {
            // arrange
            OrderItem item = new OrderItem()
            {
                ID = 10
            };
            Mock <DbSet <OrderItem> > mockSet = new Mock <DbSet <OrderItem> >();

            mockSet.Setup(s => s.Find(10)).Returns(item);
            Mock <OrderDb> mockContext = new Mock <OrderDb>();

            mockContext.Setup(c => c.OrderItems).Returns(mockSet.Object);
            OrderItemRepository sut = new OrderItemRepository(mockContext.Object);

            // act
            sut.RemoveItem(10);

            // assert
            mockSet.Verify(s => s.Remove(It.Is <OrderItem>(oi => oi.ID == 10)), Times.Once());
            mockContext.Verify(c => c.SaveChanges(), Times.Once());
        }
示例#32
0
        //   public GraphQLSchema(IDependencyResolver resolver) : base(resolver)
        ////  public GraphQLSchema(IServiceProvider provider) : base(provider)
        //  {
        //      Query = resolver.Resolve<GraphQLQueries>();
        //      //  Mutation = resolver.Resolve<GraphQLMutations>();

        //  }


        public GraphQLSchema(OrderRepository orderRepository, OrderItemRepository orderItemRepository) => Query = new GraphQLQueries(orderRepository, orderItemRepository);
示例#33
0
 public void TestCleanup()
 {
     m_orderItemRepository = null;
 }
示例#34
0
 public void TestSetup()
 {
     m_orderItemRepository = new OrderItemRepository();
 }
 public OrderItemService(OrderItemRepository orderItemRepository, CustomerRepository customerRepository)
 {
     this.orderItemRepository = orderItemRepository;
     this.customerRepository  = customerRepository;
 }