예제 #1
0
        public void SendInitialTest()
        {
            var config = TestConfig.GetPushoverGetConfig();
            var client = new PushoverClient(config);

            var message = new PushoverMessage(TestConfig.UserKey)
            {
                Message = "This is a test message Rachel",
                Priority = PushoverPriority.Normal,
                Sound = PushoverSound.Bike,
                Title = "Hello World",
                Url = "http://google.co.za",
                UrlTitle = "Google"
            };

            client.SendNotification(message);
        }
예제 #2
0
        public void SendDodgeyRequest()
        {
            var config = TestConfig.GetPushoverGetConfig();
            var client = new PushoverClient(config);

            var message = new PushoverMessage()
            {
                Message = "This is a test message Rachel",
                Priority = PushoverPriority.Normal,
                Sound = PushoverSound.Bike,
                Title = "Hello World",
                Url = "http://google.co.za",
                UrlTitle = "Google"
            };

            var result = client.SendNotification(message);

            Assert.IsFalse(result.WasSuccessful);
        }
예제 #3
0
        public void Booo()
        {
            var httpClient = Substitute.For<IHttpClient>();
            var config = TestConfig.GetPushoverGetConfig();
            config.HttpClient = httpClient;

            var client = new PushoverClient(config);
            var message = new PushoverMessage(TestConfig.UserKey)
            {
                Message = "This is a test message Rachel",
                Priority = PushoverPriority.Normal,
                Sound = PushoverSound.Bike,
                Title = "Hello World",
                Url = "http://google.co.za",
                UrlTitle = "Google"
            };


            httpClient.Received().PostAsync(Arg.Any<string>(), Arg.Is<FormUrlEncodedContent>(form =>
                form.ToString().Contains("bb")));

            client.SendNotification(message);
        }