private static void ConfigurationDependencies() { var dbConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; ServiceCollection = new ServiceCollection() //.AddDbContextPool<NiisWebContext>(options => options.UseSqlServer(dbConnectionString), poolSize: 8) .AddDbContext <NiisWebContext>(options => options.UseSqlServer(dbConnectionString)) .AddTransient <DbContext, NiisWebContext>() .AddTransient <IExecutor, NiisRepository>() .AddTransient <IAmbientContext, AmbientContext>() .AddTransient <IUnitOfWork, UnitOfWork>() .AddTransient <IObjectResolver, ObjectResolver>() .AddTransient <IRuleExecutor, RuleExecutor>() .AddTransient <IDateTimeProvider, DateTimeProvider>() .AddTransient <ICalendarProvider, CalendarProvider>() .AddTransient <IIntegrationStatusUpdater, IntegrationStatusUpdater>() .AddTransient <IIntegrationDocumentUpdater, IntegrationDocumentUpdater>() .AddTransient <IDicTypeResolver, DicTypeResolver>() .AddTransient <IFileStorage, MinioFileStorage>() .AddTransient <DictionaryHelper>() .AddSingleton <NiisAmbientContext>() .AddSingleton <RequestAppellationOfOriginWorkflow>() .AddNiisWorkFlowBusinessLogicDependencies() .AddAutoMapper(mapperConfig => mapperConfig.AddProfiles(typeof(Program).Assembly)) .AddWorkflowServices(); ServiceProvider = ServiceCollection.BuildServiceProvider(); var _ = new AmbientContext(ServiceProvider); var __ = new NiisAmbientContext(ServiceProvider, null); var ___ = new NiisWorkflowAmbientContext(ServiceProvider); }
public AccessorFactory(AmbientContext context, UtilityFactory utilityFactory) : base(context) { // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories _utilityFactory = utilityFactory ?? new UtilityFactory(Context); //AddType<IShippingRulesAccessor>(typeof(ShippingRulesAccessor)); }
public void ProcessRequest(IAsyncResult result) { if (_isDisposed) return; HttpListenerContext nativeContext; try { nativeContext = _listener.EndGetContext(result); } catch (HttpListenerException) { return; } QueueNextRequestPending(); var ambientContext = new AmbientContext(); var context = new HttpListenerCommunicationContext(this, nativeContext); try { using (new ContextScope(ambientContext)) { IncomingRequestReceived(this, new IncomingRequestReceivedEventArgs(context)); } } finally { using (new ContextScope(ambientContext)) { IncomingRequestProcessed(this, new IncomingRequestProcessedEventArgs(context)); } } }
static void Main(string[] args) { Console.WriteLine("Starting BackOffice"); var context = new AmbientContext() { SellerId = 2, AuthToken = "MyToken" }; commands = new BaseUICommand[] { new TotalsCommand(context), }; // get the first menu selection int menuSelection = InitConsoleMenu(); while (menuSelection != 99) { if (menuSelection < commands.Length) { var cmd = commands[menuSelection]; cmd?.Run(); } else { Console.WriteLine("Invalid Command"); } // re-initialize the menu selection menuSelection = InitConsoleMenu(); } }
public void Admin_SaveCatalogSellerIdMismatch() { // Retrieve the catalog var context = new AmbientContext() { SellerId = 1, AuthToken = "MyToken" }; var managerFactory = new ManagerFactory(context); var adminCatalogManager = managerFactory.CreateManager <IAdminCatalogManager>(); var response = adminCatalogManager.ShowCatalog(1); string responseJson = StringUtilities.DataContractToJson(response); string expectedJson = StringUtilities.DataContractToJson(AdminResponses.CatalogResponse); // Compare the response to a static representation of the response Assert.AreEqual(expectedJson, responseJson); // change the description and update the catalog response.Catalog.Description = "TEST_CATALOG updated description"; // change the seller id in the context and recreate the manager managerFactory.Context.SellerId = 2; adminCatalogManager = managerFactory.CreateManager <IAdminCatalogManager>(); var updateResponse = adminCatalogManager.SaveCatalog(response.Catalog); responseJson = StringUtilities.DataContractToJson(updateResponse); expectedJson = StringUtilities.DataContractToJson(AdminResponses.CatalogSellerIdMismatchResponse); // Compare the update response to a static representation of the response Assert.AreEqual(expectedJson, responseJson); }
public void Admin_SaveProductCatalogIdMismatch() { // Retrieve the product var context = new AmbientContext() { SellerId = 1, AuthToken = "MyToken" }; var managerFactory = new ManagerFactory(context); var adminCatalogManager = managerFactory.CreateManager <IAdminCatalogManager>(); var response = adminCatalogManager.ShowProduct(2, 1003); // normalize decimal percision - SQL Server and Sqlite behave differently response.Product.Price = response.Product.Price + 0.00M; string responseJson = StringUtilities.DataContractToJson(response); string expectedJson = StringUtilities.DataContractToJson(AdminResponses.ProductResponse); // Compare the response to a static representation of the response Assert.AreEqual(expectedJson, responseJson); // change the summary and update the product response.Product.Summary = "TEST_PRODUCT updated summary"; // update the catalog id and recreate the manager adminCatalogManager = managerFactory.CreateManager <IAdminCatalogManager>(); var updateResponse = adminCatalogManager.SaveProduct(3, response.Product); responseJson = StringUtilities.DataContractToJson(updateResponse); expectedJson = StringUtilities.DataContractToJson(AdminResponses.ProductCatalogIdMismtachResponse); // Compare the update response to a static representation of the response Assert.AreEqual(expectedJson, responseJson); }
public IResponse ProcessRequest(IRequest request) { CheckNotDisposed(); var ambientContext = new AmbientContext(); var context = new InMemoryCommunicationContext { ApplicationBaseUri = new Uri("http://localhost"), Request = request, Response = new InMemoryResponse() }; try { using (new ContextScope(ambientContext)) { RaiseIncomingRequestReceived(context); } } finally { using (new ContextScope(ambientContext)) { RaiseIncomingRequestProcessed(context); } } return context.Response; }
registering_instances_in_different_scopes_results_in_only_the_context_specific_registrations_to_be_resolved_in_a_context() { var objectForScope1 = new TheClass(); var objectForScope2 = new TheClass(); var scope1 = new AmbientContext(); var scope2 = new AmbientContext(); IDisposable scope1Request, scope2Request; Resolver.AddDependency <IContextStore, AmbientContextStore>(); using (new ContextScope(scope1)) { Resolver.CreateRequestScope(); Resolver.AddDependencyInstance <TheClass>(objectForScope1, DependencyLifetime.PerRequest); } using (new ContextScope(scope2)) { Resolver.CreateRequestScope(); Resolver.AddDependencyInstance <TheClass>(objectForScope2, DependencyLifetime.PerRequest); } using (new ContextScope(scope1)) { Resolver.ResolveAll <TheClass>() .ShouldBe(new[] { objectForScope1 }); } }
/// <summary> /// Этот метод вызывается во время выполнения. Используйте этот метод для добавления сервисов в контейнер. /// </summary> /// <param name="services">Определяет контракт для набора дескрипторов сервисов.</param> public void ConfigureServices(IServiceCollection services) { services.AddSwaggerGen(swaggerGenOptions => { swaggerGenOptions.SwaggerDoc("v1", new Info { Title = "Integration 1C API", Version = "v1" }); }); //DI соединения с 1C. services.AddTransient <IOneCConnection>(s => new OneCConnection(Configuration.GetOneCConnectionString())); services .AddTransient <DbContext, NiisOneEmptyDbContext>() .AddTransient <IExecutor, NiisRepository>() .AddTransient <IAmbientContext, AmbientContext>() .AddTransient <IUnitOfWork, UnitOfWork>() .AddTransient <IObjectResolver, ObjectResolver>(); #region егистрируем CQRS Query services.AddTransient <GetPaymentsByDateRangeQuery>(); #endregion #region JWT services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => JwtBearerConfigureOptions.Configure(options, Configuration)); #endregion services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); var _ = new AmbientContext(services.BuildServiceProvider()); var __ = new NiisOneCIntegrationAmbientContext(services.BuildServiceProvider()); }
public void Webstore_SubmitOrderBadPaymentMethod() { // create the cart var context = new AmbientContext() { SellerId = 1, SessionId = Guid.NewGuid() }; var webStoreCartManager = GetManager <IWebStoreCartManager>(context); var cartResponse = webStoreCartManager.SaveCartItem(1, 1, 2); Assert.IsTrue(cartResponse.Success); // update the cart shipping/billing info cartResponse = webStoreCartManager.UpdateShippingInfo(1, _myAddress, true); Assert.IsTrue(cartResponse.Success); // submit the order with a invalid credit card var webStoreOrderManager = GetManager <IWebStoreOrderManager>(context); var payment = new PaymentInstrument() { AccountNumber = "5111111111111111", PaymentType = PaymentTypes.CreditCard, ExpirationDate = "01/2019" }; var response = webStoreOrderManager.SubmitOrder(1, payment); // verify the order failed Assert.IsFalse(response.Success); Assert.AreEqual("There was a problem processing the payment", response.Message); Assert.AreEqual(OrderStatuses.Failed, response.Order.Status); Assert.IsTrue(string.IsNullOrEmpty(response.Order.AuthorizationCode)); }
public void ProcessRequest(IAsyncResult result) { if (_isDisposed) { return; } HttpListenerContext nativeContext; try { nativeContext = _listener.EndGetContext(result); } catch (HttpListenerException) { return; } QueueNextRequestPending(); var ambientContext = new AmbientContext(); var context = new HttpListenerCommunicationContext(this, nativeContext); try { using (new ContextScope(ambientContext)) { IncomingRequestReceived(this, new IncomingRequestReceivedEventArgs(context)); } } finally { using (new ContextScope(ambientContext)) { IncomingRequestProcessed(this, new IncomingRequestProcessedEventArgs(context)); } } }
async Task ProcessContext() { QueueNextRequestPending(); HttpListenerContext nativeContext; try { nativeContext = await _listener.GetContextAsync(); } catch (HttpListenerException) { return; } var ambientContext = new AmbientContext(); var context = new HttpListenerCommunicationContext(this, nativeContext); try { using (new ContextScope(ambientContext)) { var incomingRequestReceivedEventArgs = new IncomingRequestReceivedEventArgs(context); IncomingRequestReceived(this, incomingRequestReceivedEventArgs); await incomingRequestReceivedEventArgs.RunTask; } } finally { using (new ContextScope(ambientContext)) { IncomingRequestProcessed(this, new IncomingRequestProcessedEventArgs(context)); } } }
public void Webstore_SubmitOrderBadCart() { // create the cart but don't put address information in var context = new AmbientContext() { SellerId = 1, SessionId = Guid.NewGuid() }; var webStoreCartManager = GetManager <IWebStoreCartManager>(context); var cartResponse = webStoreCartManager.SaveCartItem(1, 1, 2); Assert.IsTrue(cartResponse.Success); Assert.IsTrue(cartResponse.Success); // submit the order with a valid credit card var webStoreOrderManager = GetManager <IWebStoreOrderManager>(context); var payment = new PaymentInstrument() { AccountNumber = "4111111111111111", PaymentType = PaymentTypes.CreditCard, ExpirationDate = "01/2019" }; var response = webStoreOrderManager.SubmitOrder(1, payment); // verify the order failed Assert.IsFalse(response.Success); Assert.AreEqual("ShippingAddress address is not valid", response.Message); Assert.IsNull(response.Order); }
private ManagerFactory CreateFactory() { var context = new AmbientContext(); var managerFactory = new ManagerFactory(context); return(managerFactory); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddLocalization(options => options.ResourcesPath = "Resources"); services //.AddDbContext<NetCoreIdentityDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("NetCoreIdentityServer"))) .AddDbContext <NetCoreIdentityDbContext>(options => options.UseNpgsql(Configuration.GetConnectionString("NetCoreIdentityServer"))) .AddTransient <DbContext, NetCoreIdentityDbContext>() .AddTransient <IExecutor, Executor>() .AddTransient <IAmbientContext, AmbientContext>() .AddTransient <IUnitOfWork, UnitOfWork>() .AddTransient <IObjectResolver, ObjectResolver>() .AddTransient <IHttpContextAccessor, HttpContextAccessor>() .AddNetCoreIdentityBusinessLogicDependencies(); services.AddCors(options => { options.AddPolicy("allowAnyOrigin", policy => { policy.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); options.AddPolicy("localOriginOnly", policy => { policy.WithOrigins(Configuration.GetSection("Identity").GetSection("Url").Value) .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); }); services.AddMvc(); var certUrl = string.IsNullOrEmpty(Configuration[CertUrlParameter]) ? "wwwroot/Certs/localhost.pfx" : Configuration[CertUrlParameter]; var certPass = string.IsNullOrEmpty(Configuration[CertPassParameter]) ? "123" : Configuration[CertPassParameter]; services.AddIdentityServer( options => { options.Authentication.CookieLifetime = TimeSpan.FromHours(24); options.Authentication.CookieSlidingExpiration = false; } ) .AddSigningCredential(new X509Certificate2($"{certUrl}", certPass)) .AddCustomUserStore() .AddInMemoryIdentityResources(Config.GetIdentityResources()) .AddInMemoryApiResources(Config.GetApiResources()) .AddInMemoryClients(Config.GetClients(Environment.IsProduction())) .AddJwtBearerClientAuthentication(); var serviceProvider = services.BuildServiceProvider(); var _ = new AmbientContext(serviceProvider); }
public IResponse ProcessRequest(IRequest request) { CheckNotDisposed(); var ambientContext = new AmbientContext(); var context = new InMemoryCommunicationContext { ApplicationBaseUri = new Uri("http://localhost"), Request = request, Response = new InMemoryResponse() }; try { using (new ContextScope(ambientContext)) { RaiseIncomingRequestReceived(context); } } finally { using (new ContextScope(ambientContext)) { RaiseIncomingRequestProcessed(context); } } return(context.Response); }
public void registering_instances_in_different_scopes_results_in_each_consumer_getting_the_correct_registration() { var objectForScope1 = new TheClass(); var objectForScope2 = new TheClass(); var scope1 = new AmbientContext(); var scope2 = new AmbientContext(); Resolver.AddDependency <IContextStore, AmbientContextStore>(); IDisposable scope1Request, scope2Request; using (new ContextScope(scope1)) { scope1Request = Resolver.CreateRequestScope(); Resolver.AddDependencyInstance <TheClass>(objectForScope1, DependencyLifetime.PerRequest); } using (new ContextScope(scope2)) { scope2Request = Resolver.CreateRequestScope(); Resolver.AddDependencyInstance <TheClass>(objectForScope2, DependencyLifetime.PerRequest); } using (new ContextScope(scope1)) { Resolver.Resolve <TheClass>().ShouldBeSameAs(objectForScope1); } using (new ContextScope(scope2)) { Resolver.Resolve <TheClass>().ShouldBeSameAs(objectForScope2); } }
public AccessorFactory(AmbientContext context, UtilityFactory utilityFactory) : base(context) { // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories _utilityFactory = utilityFactory ?? new UtilityFactory(Context); AddType <IProjectAccess>(typeof(ProjectAccess)); }
public HandlebarsTemplate <TextWriter, object, object> Compile(TextReader template) { using var container = AmbientContext.Use(_ambientContext); var configuration = CompiledConfiguration ?? new HandlebarsConfigurationAdapter(Configuration); var formatterProvider = new FormatterProvider(configuration.FormatterProviders); var objectDescriptorFactory = new ObjectDescriptorFactory(configuration.ObjectDescriptorProviders); var localContext = AmbientContext.Create( _ambientContext, formatterProvider: formatterProvider, descriptorFactory: objectDescriptorFactory ); using var localContainer = AmbientContext.Use(localContext); var compilationContext = new CompilationContext(configuration); using var reader = new ExtendedStringReader(template); var compiledTemplate = HandlebarsCompiler.Compile(reader, compilationContext); return((writer, context, data) => { using var disposableContainer = AmbientContext.Use(localContext); if (writer is EncodedTextWriterWrapper encodedTextWriterWrapper) { var encodedTextWriter = encodedTextWriterWrapper.UnderlyingWriter; if (context is BindingContext bindingContext) { compiledTemplate(encodedTextWriter, bindingContext); return; } using var newBindingContext = BindingContext.Create(configuration, context); newBindingContext.SetDataObject(data); compiledTemplate(encodedTextWriter, newBindingContext); } else { if (context is BindingContext bindingContext) { var config = bindingContext.Configuration; using var encodedTextWriter = new EncodedTextWriter(writer, config.TextEncoder, formatterProvider, config.NoEscape); compiledTemplate(encodedTextWriter, bindingContext); } else { using var newBindingContext = BindingContext.Create(configuration, context); newBindingContext.SetDataObject(data); using var encodedTextWriter = new EncodedTextWriter(writer, configuration.TextEncoder, formatterProvider, configuration.NoEscape); compiledTemplate(encodedTextWriter, newBindingContext); } } }); }
public Connection(ConnectionFactory connectionFactory, DatabaseProvider provider, ILogger logger) { _connectionFactory = connectionFactory; _ambientContext = new AmbientContext <Connection>(); RegisterToTransactionScope(); Initialize(provider, logger); }
public void Admin_OrderFulfillment() { // TODO: This is common code between Webstore and Admin integration tests -- consolidate // create the cart var context = new AmbientContext() { SellerId = 1, SessionId = Guid.NewGuid() }; var webStoreCartManager = GetManager <IWebStoreCartManager>(context); var cartResponse = webStoreCartManager.SaveCartItem(1, 1, 2); Assert.IsTrue(cartResponse.Success); // update the cart shipping/billing info cartResponse = webStoreCartManager.UpdateShippingInfo(1, _myAddress, true); Assert.IsTrue(cartResponse.Success); // submit the order with a valid credit card var webStoreOrderManager = GetManager <IWebStoreOrderManager>(context); var payment = new PaymentInstrument() { AccountNumber = "4111111111111111", PaymentType = PaymentTypes.CreditCard, ExpirationDate = "01/2019" }; var orderResponse = webStoreOrderManager.SubmitOrder(1, payment); // verify the order success Assert.IsTrue(orderResponse.Success); Assert.IsTrue(orderResponse.Order.Id > 0); Assert.AreEqual(OrderStatuses.Authorized, orderResponse.Order.Status); Assert.IsFalse(string.IsNullOrEmpty(orderResponse.Order.AuthorizationCode)); // get orders to fulfill context.AuthToken = "my valid token"; var fulfillmentManager = GetManager <IAdminFulfillmentManager>(context); var orderToFulfilleResponse = fulfillmentManager.GetOrdersToFulfill(); Assert.IsTrue(orderToFulfilleResponse.Success); Assert.IsTrue(orderToFulfilleResponse.Orders.Length > 0); bool orderFound = false; foreach (var order in orderToFulfilleResponse.Orders) { if (order.Id == orderResponse.Order.Id) { orderFound = true; } } Assert.IsTrue(orderFound); // fulfill the order var fulfillmentResponse = fulfillmentManager.FulfillOrder(orderResponse.Order.Id); Assert.IsTrue(fulfillmentResponse.Success); }
private static void SetMessagePriorityInAmbientContext(Message message) { AmbientContext context = AmbientContext.TryGetCurrentContext(); if (context != null) { context[Constants.AmbientContextIndexes.BuildMessagePriority] = message.Priority; } }
public EngineFactory(AmbientContext context, AccessorFactory accessorFactory, UtilityFactory utilityFactory) : base(context) { // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories _utilityFactory = utilityFactory ?? new UtilityFactory(Context); _accessorFactory = accessorFactory ?? new AccessorFactory(Context, _utilityFactory); //AddType<IRemittanceCalculationEngine>(typeof(RemittanceCalculationEngine)); }
public CommonModule(bool isBuildServiceProvider = true) { Context = AmbientContext.Current; Configure(); if (isBuildServiceProvider) { Context.BuildServiceProvider(); } }
private EngineFactory CreateFactory() { var context = new AmbientContext(); var utilityFactory = new UtilityFactory(context); var accessorFactory = new AccessorFactory(context, utilityFactory); var engineFactory = new EngineFactory(context, accessorFactory, utilityFactory); return(engineFactory); }
public void Webstore_ShowCatalog() { var context = new AmbientContext() { SellerId = 1 }; var webStoreCatalogManager = GetManager <IWebStoreCatalogManager>(context); var response = webStoreCatalogManager.ShowCatalog(1); Assert.AreEqual(1000, response.Catalog.Products.Length); }
private static void RebuildSearch(int catalogId) { var context = new AmbientContext() { SellerId = 1 }; var managerFactory = new ManagerFactory(context); var webStoreCatalogManager = managerFactory.CreateManager <Contracts.Admin.Catalog.IAdminCatalogManager>(); webStoreCatalogManager.RebuildCatalog(catalogId); }
private HandlebarsTemplate <TextWriter, object, object> CompileViewInternal(string templatePath, ViewReaderFactory readerFactoryFactory) { using var container = AmbientContext.Use(_ambientContext); var configuration = CompiledConfiguration ?? new HandlebarsConfigurationAdapter(Configuration); var formatterProvider = new FormatterProvider(configuration.FormatterProviders); var objectDescriptorFactory = new ObjectDescriptorFactory(configuration.ObjectDescriptorProviders); var localContext = AmbientContext.Create( _ambientContext, formatterProvider: formatterProvider, descriptorFactory: objectDescriptorFactory ); using var localContainer = AmbientContext.Use(localContext); var createdFeatures = configuration.Features; for (var index = 0; index < createdFeatures.Count; index++) { createdFeatures[index].OnCompiling(configuration); } var compilationContext = new CompilationContext(configuration); var compiledView = HandlebarsCompiler.CompileView(readerFactoryFactory, templatePath, compilationContext); for (var index = 0; index < createdFeatures.Count; index++) { createdFeatures[index].CompilationCompleted(); } return((writer, context, data) => { using var disposableContainer = AmbientContext.Use(localContext); if (context is BindingContext bindingContext) { bindingContext.Extensions["templatePath"] = templatePath; var config = bindingContext.Configuration; using var encodedTextWriter = new EncodedTextWriter(writer, config.TextEncoder, formatterProvider, config.NoEscape); compiledView(encodedTextWriter, bindingContext); } else { using var newBindingContext = BindingContext.Create(configuration, context); newBindingContext.Extensions["templatePath"] = templatePath; newBindingContext.SetDataObject(data); using var encodedTextWriter = new EncodedTextWriter(writer, configuration.TextEncoder, formatterProvider, configuration.NoEscape); compiledView(encodedTextWriter, newBindingContext); } }); }
private static void ShowCart(Guid sessionId) { var context = new AmbientContext() { SellerId = 1, SessionId = sessionId }; var managerFactory = new ManagerFactory(context); var webStoreCartManager = managerFactory.CreateManager <IWebStoreCartManager>(); var response = webStoreCartManager.ShowCart(1); ShowResponse(response, StringUtilities.DataContractToJson <WebStoreCart>(response.Cart)); }
private static void RemoveItemFromCart(int productId, Guid sessionId) { var context = new AmbientContext() { SellerId = 1, SessionId = sessionId }; var managerFactory = new ManagerFactory(context); var webStoreCartManager = managerFactory.CreateManager <IWebStoreCartManager>(); var response = webStoreCartManager.RemoveCartItem(1, productId); ShowResponse(response, StringUtilities.DataContractToJson <WebStoreCart>(response.Cart)); }
private static void UpdateShippingInfo(Address shippingAddress, bool billingSameAsShipping, Guid sessionId) { var context = new AmbientContext() { SellerId = 1, SessionId = sessionId }; var managerFactory = new ManagerFactory(context); var webStoreCartManager = managerFactory.CreateManager <IWebStoreCartManager>(); var response = webStoreCartManager.UpdateShippingInfo(1, shippingAddress, billingSameAsShipping); ShowResponse(response, StringUtilities.DataContractToJson <WebStoreCart>(response.Cart)); }
private static void SubmitOrder(Guid sessionId) { var context = new AmbientContext() { SellerId = 1, SessionId = sessionId }; var managerFactory = new ManagerFactory(context); var webStoreOrderManager = managerFactory.CreateManager <IWebStoreOrderManager>(); var response = webStoreOrderManager.SubmitOrder(1, PaymentInstrument); ShowResponse(response, StringUtilities.DataContractToJson <WebStoreOrder>(response.Order)); }