public void Send_PostMuiltipleSms() { // Act var injectOptions = new InjectOptions(); var controller = new SendController( injectOptions.Authentication, injectOptions.GenerateQueryString, injectOptions.GenerateUrl, injectOptions.SmsRequest, injectOptions.SmsLogger); // Arrange var body = new List <SmsModel> { new SmsModel() { Message = "message 1 " + DateTime.Now.ToString("yyyyMMddhhsss"), Number = "27831111111" }, new SmsModel() { Message = "message 2 " + DateTime.Now.ToString("yyyyMMddhhsss"), Number = "27831111111" } }; var response = controller.Post(body); // Assert Assert.IsTrue(response != ""); Assert.IsTrue(response.Length > 10); }
public InjectAttributeBindingProvider( ExtensionConfigContext context, InjectOptions options, ILogger logger) { _extensionConfigContext = context ?? throw new ArgumentNullException(nameof(context)); _options = options ?? throw new ArgumentNullException(nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public ISocketHookService CreateWith(InjectOptions options) { if (options.RedirectedIps == null || !options.RedirectedIps.Any()) { throw new ArgumentNullException(nameof(options.RedirectedIps)); } if (options.RedirectionPort == default) { throw new ArgumentNullException(nameof(options.RedirectionPort)); } return(new SocketHookService(_client, _hookLifetime, options)); }
/// <summary> /// Injects an event into Salesforce using /// the supplied CLI authentication and /// event arguments. /// </summary> public int Init(InjectOptions o) { _AuthArgs = CreateAuthArgs(o.AuthArgs); _EventArgs = CreateEventArgs(o.EventArgs); _Client = CreateClient(); try { dynamic evt = null; try { evt = EventCreator.CreateEvent( _EventArgs.EventClassName, _EventArgs.EventFieldsClassName, _EventArgs.EventFieldsPropValues); } catch (Exception e) when( e is UnknownPlatformEventException || e is UnknownPlatformEventFieldsException || e is InvalidCommandLineArgumentIndexException) { Console.WriteLine($"{e.GetType()}: {e.Message}"); } try { _Client.RequestAccessToken().Wait(); } catch (Exception e) when(e is InsufficientAccessTokenRequestException) { Console.WriteLine($"{e.GetType()}: {e.Message}"); } try { _Client.InjectEvent(evt).Wait(); } catch (Exception e) when( e is InsufficientEventInjectionException || e is InvalidPlatformEventException || e is EventInjectionUnsuccessfulException) { Console.WriteLine($"{e.GetType()}: {e.Message}"); } } catch (RuntimeBinderException e) { Console.WriteLine($"{e.GetType()}: No event was bounded to the dynamic type."); } return(0); }
public void SetHeader_WithUserConfigValues() { // Act var injectOptions = new InjectOptions(); var objGenerateUrl = injectOptions.GenerateUrl; // Arrange var url = objGenerateUrl.GenerateSend(); // Assert Assert.IsTrue(url != ""); Assert.IsTrue(url.Length > 10); }
public void SetHeader_WithUserConfigValues() { // Act var injectOptions = new InjectOptions(); var objAuthentication = injectOptions.Authentication; // Arrange var headerValue = objAuthentication.SetHeader(); // Assert Assert.IsTrue(headerValue != ""); Assert.IsTrue(headerValue.Length > 10); }
public void SendLog_Get() { // Act var injectOptions = new InjectOptions(); var controller = new SendLogController( injectOptions.Authentication, injectOptions.GenerateQueryString, injectOptions.GenerateUrl, injectOptions.SmsRequest, injectOptions.SmsLogger); // Arrange string waterMark = "201342443"; waterMark = "247"; var response = controller.Get(waterMark); // Assert Assert.IsTrue(response != ""); Assert.IsTrue(response.Length > 10); }
public SocketHookService(HttpClient client, IHookLifetimeService hookLifetime, InjectOptions options = default) { _injectionSettings = options?.ToString(); _hookLifetime = hookLifetime; _client = client; }