public PaymentTest() { serviceMode = ServiceMode.Sandbox; context = new AuthorizeDotNetContext(apiLoginId, transactionKey, "USD", serviceMode); repository = new AuthorizeDotNetPaymentRepository(context); service = new AuthorizeDotNetPaymentService(repository); }
private void RestartService(string serviceName, int timeoutMilliseconds, ServiceMode serviceMode) { ServiceController service = new ServiceController(serviceName); try { int millisec1 = Environment.TickCount; TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds); if (serviceMode == ServiceMode.Start) { goto start; } service.Stop(); service.WaitForStatus(ServiceControllerStatus.Stopped, timeout); if (serviceMode == ServiceMode.Stop) { return; } service.Start(); start: // count the rest of the timeout int millisec2 = Environment.TickCount; timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds - (millisec2 - millisec1)); service.WaitForStatus(ServiceControllerStatus.Running, timeout); } catch { } }
public void Verify_Try_Bump(ServiceMode mode, string givenSource , string expectedSource, bool expectedTrySuccess , IBumpVersionDescriptor descriptor) { // TODO: TBD: split the lines here approaching the test? or within the test itself? IEnumerable <string> SplitLines(string s = null) => (s ?? Empty).Replace("\r\n", "\n").Split('\n'); string CombineLines(IEnumerable <string> lines) => Join("\r\n", lines); // TODO: TBD: this is it, I think, in a nutshell; notwithstanding nuances... Assert.NotNull(descriptor); Assert.NotNull(descriptor.VersionProviderTemplates); Assert.Collection(descriptor.VersionProviderTemplates , p => { Assert.NotNull(p); } , p => { Assert.NotNull(p); } , p => { Assert.NotNull(p); } , p => { Assert.NotNull(p); } , p => { Assert.NotNull(p); } ); var service = CreateServiceFixture(mode, descriptor); var givenLines = SplitLines(givenSource).ToArray(); var actualTrySuccess = service.TryBumpVersion(givenLines, out var actualLines); Assert.Equal(expectedTrySuccess, actualTrySuccess); var actualSource = CombineLines(actualLines); Assert.Equal(expectedSource, actualSource); }
public static void Initialize(ServiceMode mode) { var result = OCStack.OCInit(null, 0, (OCMode)mode); //var result = OCStack.OCInit1((OCMode)mode, OCTransportFlags.OC_DEFAULT_FLAGS, OCTransportFlags.OC_DEFAULT_FLAGS); if (result != OCStackResult.OC_STACK_OK) { throw new Exception(result.ToString()); } ct = new CancellationTokenSource(); tcs = new TaskCompletionSource <object>(); #if NETFX_CORE Task.Run(async() => #else ThreadPool.QueueUserWorkItem(async(s) => #endif { while (!ct.IsCancellationRequested) { var result2 = OCStack.OCProcess(); if (result2 != OCStackResult.OC_STACK_OK) { // tcs.SetException(new Exception("OCStackException on Process: " + result2.ToString())); // break; } await Task.Delay(1); } tcs.SetResult(true); tcs = null; ct = null; }); }
/// <summary> /// Initializes a new instance of the <see cref="HttpXmlUtility"/> class. /// </summary> /// <param name="mode">The mode.</param> /// <param name="apiLogin">The API login.</param> /// <param name="transactionKey">The transaction key.</param> public HttpXmlUtility(ServiceMode mode, string apiLogin, string transactionKey) { if (mode == ServiceMode.Live) _serviceUrl = "https://api.authorize.net/xml/v1/request.api"; _apiLogin = apiLogin; _transactionKey = transactionKey; }
public AuthorizeDotNetContext(string apiLoginId, string transactionKey, string currency, ServiceMode serviceMode) { _apiLoginId = apiLoginId; _transactionKey = transactionKey; ServiceMode = serviceMode; Currency = currency; }
public PaymentTest() { serviceMode = ServiceMode.Test; context = new QuickBooksOnlineContext(consumerKey, consumerSecret, accessToken, accessTokenSecret, "", serviceMode, "USD", realmId, ""); repository = new QuickBooksOnlinePaymentRepository(context); service = new QuickBooksOnlinePaymentService(repository); }
/// <summary> /// Verifies the Fixture <paramref name="service"/>. /// </summary> /// <typeparam name="TService"></typeparam> /// <param name="service"></param> /// <param name="expectedMode"></param> // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local private static void VerifyFixture <TService>(TService service // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local , ServiceMode expectedMode) where TService : class, IBumpVersionService { Assert.NotNull(service); Assert.Equal(expectedMode, service.Mode); }
/// <summary> /// Initializes a new instance of the <see cref="CustomerGateway"/> class. /// </summary> /// <param name="apiLogin">The API login.</param> /// <param name="transactionKey">The transaction key.</param> /// <param name="mode">Test or Live.</param> public ReportingGateway(string apiLogin, string transactionKey, ServiceMode mode) { if (mode == ServiceMode.Live) { _gateway = new HttpXmlUtility(ServiceMode.Live, apiLogin, transactionKey); } else { _gateway = new HttpXmlUtility(ServiceMode.Test, apiLogin, transactionKey); } }
/// <summary> /// Registers and binds service with a given id to objects of specified type, created later at runtime by specified handler. /// </summary> public RegisteredServiceContext Register(IEnumerable <Type> id, ServiceMode mode, ServiceCreationHandler creationHandler, params object[] constructorArgs) { if (id == null) { throw new ArgumentNullException("id"); } return(RegisterServiceObject(_typeServices, id, GetWrapper(id, id, creationHandler, mode, constructorArgs))); }
/// <summary> /// Registers and binds service with a given type to objects of specified type, created later at runtime. /// </summary> public RegisteredServiceContext Register <T>(Type serviceType, ServiceMode mode, params object[] constructorArgs) { if (serviceType != null) { VerifyServiceObjectType(typeof(T), serviceType); } return(RegisterServiceObject(_typeServices, typeof(T), GetWrapper(serviceType, mode, constructorArgs))); }
public KeyboardService(ServiceMode mode, string host = null, int? port = null) { var sik = mode == ServiceMode.Sender ? (IKeyboard)new TcpKeyboard(host, port.Value) : new SendInputKeyboard(); targetKeyboard = new Keyboard(sik, new SemanticKeyboard(sik)); this.mode = mode; this.host = host; this.port = port; }
/// <summary> /// Initializes a new instance of the <see cref="HttpXmlUtility"/> class. /// </summary> /// <param name="mode">The mode.</param> /// <param name="apiLogin">The API login.</param> /// <param name="transactionKey">The transaction key.</param> public HttpXmlUtility(ServiceMode mode, string apiLogin, string transactionKey) { if (mode == ServiceMode.Live) { _serviceUrl = "https://api.authorize.net/xml/v1/request.api"; } _apiLogin = apiLogin; _transactionKey = transactionKey; }
public SubscriptionGateway2(string apiLogin, string transactionKey, ServiceMode mode) { if (mode == ServiceMode.Live) { _gateway = new HttpXmlUtility2(ServiceMode.Live, apiLogin, transactionKey); return; } _gateway = new HttpXmlUtility2(ServiceMode.Test, apiLogin, transactionKey); }
/// <summary> /// Initializes a new instance of the <see cref="HttpXmlUtility"/> class. /// </summary> /// <param name="mode">The mode.</param> /// <param name="apiLogin">The API login.</param> /// <param name="transactionKey">The transaction key.</param> public HttpXmlUtility(ServiceMode mode, string apiLogin, string transactionKey) { if (mode == ServiceMode.Live) { _serviceUrl = URL; } _apiLogin = apiLogin; _transactionKey = transactionKey; }
private void heatBtn_Click(object sender, EventArgs e) { if (!isOff && mode != ServiceMode.HOT) { hostService.SettModle(ServiceMode.HOT); mode = ServiceMode.HOT; workModeText.Text = Common.Constants.WORKING_MODE_STR + "制热"; } }
/// <summary> /// Initializes a new instance of the <see cref="CustomerGateway"/> class. /// </summary> /// <param name="apiLogin">The API login.</param> /// <param name="transactionKey">The transaction key.</param> /// <param name="mode">Test or Live.</param> public CustomerGateway(string apiLogin, string transactionKey, ServiceMode mode) { if (mode == ServiceMode.Live) { _gateway = new HttpXmlUtility(ServiceMode.Live, apiLogin, transactionKey); _mode = validationModeEnum.liveMode; } else { _gateway = new HttpXmlUtility(ServiceMode.Test, apiLogin, transactionKey); _mode = validationModeEnum.testMode; } }
/// <summary> /// Gets a wrapper dynamically creating service of specified type. /// </summary> private ServiceObjectWrapper GetWrapper(Type serviceType, ServiceMode mode, object[] constructorArgs) { if (serviceType == null) { return(null); } return(mode == ServiceMode.Singleton ? new ServiceTypeWrapper(this, serviceType, constructorArgs) : new ServiceTypeCloneWrapper(this, serviceType, constructorArgs)); }
/// <summary> /// Registers and binds service with a given type to objects of specified type, created later at runtime by specified handler. /// </summary> public RegisteredServiceContext Register <T>(ServiceMode mode, ServiceCreationHandler creationHandler, params object[] constructorArgs) { var id = typeof(T); if (creationHandler == null) { return(RegisterServiceObject(_typeServices, id, GetWrapper(id, mode, constructorArgs))); } return(RegisterServiceObject(_typeServices, id, GetWrapper(id, new[] { id }, creationHandler, mode, constructorArgs))); }
public PumpMain(EventLog serviceEventLog = null) { _ServiceMode = ServiceMode.Standby; _MainDbAccess = DbPackage.CreateConnection(); PumpConfig.AppSettingsInDb = _MainDbAccess.GetServiceConfig(); _ParallelJobs = new List <ParallelJob>(); _Synchronizer = new PumpSynchronizer(); _ServiceEventLog = serviceEventLog; }
/// <summary> /// Registers and binds service with a given id to objects of specified type, created later at runtime. /// </summary> public RegisteredServiceContext Register(string id, Type serviceType, ServiceMode mode, params object[] constructorArgs) { if (id == null) { throw new ArgumentNullException("id"); } if (serviceType == null) { throw new ArgumentNullException("serviceType"); } return(RegisterServiceObject(_stringServices, id, GetWrapper(serviceType, mode, constructorArgs))); }
/// <summary> /// Registers and binds service with a given id to objects of specified type, created later at runtime by specified handler. /// </summary> public RegisteredServiceContext Register(string id, ServiceMode mode, ServiceCreationHandler creationHandler, params object[] constructorArgs) { if (id == null) { throw new ArgumentNullException("id"); } if (creationHandler == null) { throw new ArgumentNullException("creationHandler"); } return(RegisterServiceObject(_stringServices, id, GetWrapper(id, null, creationHandler, mode, constructorArgs))); }
public QuickBooksOnlineContext(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret, string callbackUrl, ServiceMode serviceMode, string currency, string realmId, string minorVersion) { ServiceMode = serviceMode; Url = ServiceMode == ServiceMode.Test ? SANDBOX_URL : PRODUCTION_URL; ConsumerKey = consumerKey; ConsumerSecret = consumerSecret; AccessToken = accessToken; AccessTokenSecret = accessTokenSecret; CallbackUrl = callbackUrl; RealmId = realmId; MinorVersion = minorVersion; Currency = currency; }
/// <summary> /// Registers and binds service with a given id to objects of specified type, created later at runtime. /// </summary> public RegisteredServiceContext Register(Type id, Type serviceType, ServiceMode mode, params object[] constructorArgs) { if (id == null) { throw new ArgumentNullException("id"); } if (serviceType != null) { VerifyServiceObjectType(id, serviceType); } return(RegisterServiceObject(_typeServices, id, GetWrapper(serviceType, mode, constructorArgs))); }
/// <summary> /// Returns a Created Fixture. Should not throw any exceptions, but we do not need to test /// for this explicitly. Running successfully through passing is sufficient evidence along /// these lines. /// </summary> /// <param name="mode"></param> /// <param name="descriptor"></param> /// <param name="verify"></param> /// <returns></returns> internal static IAssemblyInfoBumpVersionService CreateServiceFixture(ServiceMode mode , IBumpVersionDescriptor descriptor = null , Action <IAssemblyInfoBumpVersionService> verify = null) { var serviceFixture = new AssemblyInfoBumpVersionServiceFixture <T>(descriptor) { Mode = mode }; VerifyFixture(serviceFixture, mode); verify?.Invoke(serviceFixture); return(serviceFixture); }
private void SetServiceMode(string switchToMode) { ServiceMode newMode; if (Enum.TryParse <ServiceMode>(switchToMode, out newMode)) { if (newMode != _ServiceMode) { if (_ServiceEventLog != null) { _ServiceEventLog.WriteEntry("ServiceMode switch from " + _ServiceMode.ToString() + " Mode to " + newMode.ToString() + " Mode."); } _ServiceMode = newMode; } } }
public bool SettModle(ServiceMode mode) { if ((int)mode == hostState.Mode) { LOGGER.WarnFormat("Cannot set to the same mode as before:{0}!", mode.ToString()); return(false); } this.hostState.Mode = (int)mode; this.hostState.NowServiceAmount = 0; void body(RemoteClient client) { client.ChangeMode(this); } Parallel.ForEach <RemoteClient>(clients.Values, body); LOGGER.InfoFormat("Finish send change mode package to each clients total:{0}!", clients.Count); return(true); }
public static Image getRuningImage(ServiceMode mode, ESpeed speed) { if (mode == ServiceMode.HOT) { switch (speed) { case ESpeed.NoWind: return(Properties.Resources.H0); case ESpeed.Small: return(Properties.Resources.H1); case ESpeed.Mid: return(Properties.Resources.H2); case ESpeed.Large: return(Properties.Resources.H3); default: return(Properties.Resources.C3); } } else { switch (speed) { case ESpeed.NoWind: return(Properties.Resources.C0); case ESpeed.Small: return(Properties.Resources.C1); case ESpeed.Mid: return(Properties.Resources.C2); case ESpeed.Large: return(Properties.Resources.C3); default: return(Properties.Resources.C3); } } }
/// <summary> /// Initializes a new instance of the <see cref="AuthorizeDotNetRequest"/> class. /// </summary> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <param name="isTestMode">if set to <c>true</c> [is test mode].</param> public AuthorizeDotNetRequest(string username, string password, ServiceMode serviceMode) { ServiceMode = serviceMode; KeyValues = new Dictionary <string, string>(); Queue(AuthorizeDotNetApi.ApiLogin, username); Queue(AuthorizeDotNetApi.TransactionKey, password); if (serviceMode == ServiceMode.Test) { Queue(AuthorizeDotNetApi.IsTestRequest, "TRUE"); } // default settings Queue(AuthorizeDotNetApi.DelimitData, "TRUE"); Queue(AuthorizeDotNetApi.DelimitCharacter, "|"); Queue(AuthorizeDotNetApi.RelayResponse, "TRUE"); Queue(AuthorizeDotNetApi.EmailCustomer, "FALSE"); Queue(AuthorizeDotNetApi.Method, "CC"); Queue(AuthorizeDotNetApi.Country, "US"); Queue(AuthorizeDotNetApi.ShipCountry, "US"); Queue(AuthorizeDotNetApi.DuplicateWindowTime, "120"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BCOShipper.DataSource = getBCO(); BCOShipper.DataTextField = "BranchCorpOfficeName"; BCOShipper.DataValueField = "BranchCorpOfficeName"; BCOShipper.DataBind(); BCOConsignee.DataSource = getBCO(); BCOConsignee.DataTextField = "BranchCorpOfficeName"; BCOConsignee.DataValueField = "BranchCorpOfficeName"; BCOConsignee.DataBind(); Shipmode.DataSource = getShipMode(); Shipmode.DataTextField = "ShipModeName"; Shipmode.DataValueField = "ShipModeName"; Shipmode.DataBind(); CommodityType.DataSource = getComtype(); CommodityType.DataTextField = "CommodityTypeName"; CommodityType.DataValueField = "CommodityTypeName"; CommodityType.DataBind(); ServiceMode.DataSource = getServiceMode(); ServiceMode.DataTextField = "ServiceModeName"; ServiceMode.DataValueField = "ServiceModeName"; ServiceMode.DataBind(); Paymode.DataSource = getPaymode(); Paymode.DataTextField = "PaymentModeName"; Paymode.DataValueField = "PaymentModeName"; Paymode.DataBind(); User.DataSource = getUser(); User.DataTextField = "FullName"; User.DataValueField = "FullName"; User.DataBind(); } }
public static void Initialize(ServiceMode mode, string dataPath = "", string securityDBDatFilename = null) { storageHandler = new StorageHandler(dataPath, securityDBDatFilename); storageHandle = GCHandle.Alloc(storageHandler); var fileresult = OCStack.OCRegisterPersistentStorageHandler(storageHandler.Handle); OCStackException.ThrowIfError(fileresult, "Failed to create storage handler"); //var result = OCStack.OCInit(null, 0, (OCMode)mode); var result = OCStack.OCInit2((OCMode)mode, OCTransportFlags.OC_DEFAULT_FLAGS, OCTransportFlags.OC_DEFAULT_FLAGS, OCTransportAdapter.OC_ADAPTER_IP); // result = OCStack.OCInit("0.0.0.0", 0, (OCMode)mode); OCStackException.ThrowIfError(result); globalHandler = OCDefaultDeviceEntityHandler; GC.KeepAlive(storageHandler); result = OCStack.OCSetDefaultDeviceEntityHandler(globalHandler, IntPtr.Zero); OCStackException.ThrowIfError(result, "Failed to send to resource"); ct = new CancellationTokenSource(); tcs = new TaskCompletionSource <object>(); Task.Run(async() => { while (!ct.IsCancellationRequested) { var result2 = OCStack.OCProcess(); if (result2 != OCStackResult.OC_STACK_OK) { // tcs.SetException(new Exception("OCStackException on Process: " + result2.ToString())); // break; } await Task.Delay(1); } tcs.SetResult(true); tcs = null; ct = null; }); }
public void Verify_Regex_Match(ServiceMode mode, string given, string expectedVersion, bool shouldMatch) { void VerifyServiceRegexes(IAssemblyInfoBumpVersionService s) { IEnumerable <Action <Regex> > GetExpectedRegexVerification() { bool ShortNameRegexExpected() => FixtureAttributeType.Name.EndsWith(nameof(Attribute)); if (ShortNameRegexExpected()) { yield return(regex => { Assert.NotNull(regex); Assert.Equal(Compiled, regex.Options); Assert.Contains($"{FixtureAttributeType.ToShortName()}", $"{regex}"); }); } yield return(regex => { Assert.NotNull(regex); Assert.Equal(Compiled, regex.Options); Assert.Contains($"{FixtureAttributeType.ToLongName()}", $"{regex}"); }); } // We should also be able to identify definitive Regular Expressions characteristics. Assert.Collection(s.AttributeRegexes, GetExpectedRegexVerification().ToArray()); } var service = CreateServiceFixture(mode, verify: VerifyServiceRegexes); Assert.Equal(shouldMatch, service.AttributeRegexes .FilterMatch(given, shouldMatch) .TryVerifyMatch(given, expectedVersion, shouldMatch)); }
/* * The setModeOfHost method tells the designated Gambler to handle any incoming RPCalls originating * from this Bookie with the behaviour specified by the ServiceMode * * Refer to the Getting started document for more information. */ public void setModeOfHost(ServiceMode serviceMode, string uniqueID) { IPEndPoint localIPEndpoint = (IPEndPoint)tcpClient.Client.LocalEndPoint; Object[] parameters = new object[] { localIPEndpoint.Address.ToString(), localIPEndpoint.Port, serviceMode.ToString() }; handleJsonRpcRequest("setModeOfHost", parameters, uniqueID); }
public abstract void processSetMode(String partnerID, ServiceMode serviceMode);
/// <summary> /// Initializes a new instance of the <see cref="HttpXmlUtility"/> class. /// </summary> /// <param name="mode">The mode.</param> /// <param name="apiLogin">The API login.</param> /// <param name="transactionKey">The transaction key.</param> public HttpXmlUtility(ServiceMode mode, string apiLogin, string transactionKey) { if (mode == ServiceMode.Live) _serviceUrl = URL; _apiLogin = apiLogin; _transactionKey = transactionKey; }
public static void setServiceMode(IPEndPoint ipEndPoint, ServiceMode mode) { serviceModes[ipEndPoint] = mode; }
public void setModeOfHost(String ipAddress, int port, ServiceMode mode) { IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse(ipAddress), port); Trace.TraceInformation("set mode of host: " + ipEndPoint + " to: " + mode); setServiceMode(ipEndPoint, mode); }