Beispiel #1
0
        public void ConstructorShouldPopulateProperties()
        {
            const string auth = "helloworld";
            const string url  = "http://localhost";
            const string key  = "1234";

            var gateway = new WhispirGateway(auth, url, key);

            gateway.ApiAuthorization.Should().Be(auth);
            gateway.ApiBaseUrl.Should().Be(url);
            gateway.ApiKey.Should().Be(key);
        }
Beispiel #2
0
        public void ContentTypeShouldBeCorrect()
        {
            const string auth = "helloworld";
            const string url  = "http://localhost";
            const string key  = "1234";

            var gateway = new WhispirGateway(auth, url, key);

            const string expected = "application/vnd.whispir.message-v1+json";

            gateway.ContentType.Should().Be(expected);
        }
Beispiel #3
0
        private static void Main(string[] args)
        {
            var options = new CommandLineOptions();

            // allow app to be debugged in visual studio.
            if (Debugger.IsAttached)
            {
                args = "-t 0404654654 -m http://ghuntley.co/1cxNHP7 ".Split(' ');
            }

            // Parse in 'strict mode'; i.e. success or quit
            if (Parser.Default.ParseArgumentsStrict(args, options))
            {
                try
                {
                    Log.Trace("Results of parsing command line arguments: {0}", options.ToJson());

                    Gateway = new WhispirGateway(
                        AppConfig.WhispirAuthorization,
                        AppConfig.WhispirApiUrl,
                        AppConfig.WhispirApiKey);

                    Dispatcher = new RetryMessageDispatcher(Gateway);

                    var job = new Job(options);

                    Dispatcher.SendSMS(job);

                    Environment.Exit((int)ExitCode.Success);
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                }
            }

            Environment.Exit((int)ExitCode.Error);
        }