コード例 #1
0
		//[TestMethod]
		//public void SearchCarts()
		//{
		//	var controller = GetCartController();
		//	var result = controller.SearchCarts(new webModel.SearchCriteria { SiteId = "test" }) as OkNegotiatedContentResult<webModel.SearchResult>;
		//	Assert.IsNotNull(result.Content);
		//}

		private static CartModuleController GetCartController()
		{
			Func<ICartRepository> repositoryFactory = () =>
			{
				return new CartRepositoryImpl("VirtoCommerce", new AuditableInterceptor(),
															   new EntityPrimaryKeyGeneratorInterceptor());
			};
			//Business logic for core model
		

			var cartService = new ShoppingCartServiceImpl(repositoryFactory, new Mock<IEventPublisher<CartChangeEvent>>().Object, new Mock<IItemService>().Object, new Mock<IDynamicPropertyService>().Object);
			var searchService = new ShoppingCartSearchServiceImpl(repositoryFactory);
			//var memoryPaymentGatewayManager = new InMemoryPaymentGatewayManagerImpl();


			var controller = new CartModuleController(cartService, searchService, new Mock<IStoreService>().Object);
			return controller;
		}
コード例 #2
0
		//[TestMethod]
		//public void SearchCarts()
		//{
		//	var controller = GetCartController();
		//	var result = controller.SearchCarts(new webModel.SearchCriteria { SiteId = "test" }) as OkNegotiatedContentResult<webModel.SearchResult>;
		//	Assert.IsNotNull(result.Content);
		//}

		private static CartModuleController GetCartController()
		{
			Func<ICartRepository> repositoryFactory = () =>
			{
				return new CartRepositoryImpl("VirtoCommerce", new AuditableInterceptor(),
															   new EntityPrimaryKeyGeneratorInterceptor());
			};
			//Business logic for core model
		

			var cartService = new ShoppingCartServiceImpl(repositoryFactory, null, null);
			var searchService = new ShoppingCartSearchServiceImpl(repositoryFactory);
			//var memoryPaymentGatewayManager = new InMemoryPaymentGatewayManagerImpl();


			var controller = new CartModuleController(cartService, searchService, null);
			return controller;
		}