Beispiel #1
0
        public void JsonPayload_TakesOverSerialization()
        {
            // Arrange
            ApplePushMessage apsNot = new ApplePushMessage()
            {
                JsonPayload = "text"
            };

            // Act
            string actual = apsNot.ToString();

            // Assert
            Assert.Equal("text", actual);
        }
Beispiel #2
0
        public void Serializes_LocKeyAndArgs()
        {
            ApplePushMessage apsNot = new ApplePushMessage();

            apsNot.Aps.AlertProperties.LocKey = "GAME_PLAY_REQUEST_FORMAT";
            apsNot.Aps.AlertProperties.LogArgs.Add("Jenna");
            apsNot.Aps.AlertProperties.LogArgs.Add("Frank");
            apsNot.Aps.Sound = "chime";
            apsNot["acme"]   = "foo";

            // Act
            string actual = apsNot.ToString();

            // Assert
            Assert.Equal(Templates["LocKeyAndArgs"], actual);
        }
Beispiel #3
0
        public void Serializes_CloseAndViewButtons()
        {
            ApplePushMessage apsNot = new ApplePushMessage();

            apsNot.Aps.Alert = "You got your emails.";
            apsNot.Aps.Badge = 9;
            apsNot.Aps.Sound = "bingbong.aiff";
            apsNot["acme1"]  = "bar";
            apsNot["acme2"]  = 42;

            // Act
            string actual = apsNot.ToString();

            // Assert
            Assert.Equal(Templates["CloseAndViewButtons"], actual);
        }
Beispiel #4
0
        public void Serializes_AlertString()
        {
            // Arrange
            ApplePushMessage apsNot = new ApplePushMessage();

            apsNot.Aps.Alert = "Message received from Bob";
            apsNot["acme2"]  = new Collection <string> {
                "bang", "whiz"
            };

            // Act
            string actual = apsNot.ToString();

            // Assert
            Assert.Equal(Templates["AlertString"], actual);
        }
Beispiel #5
0
        public void ApplePushMessage_AlertExpiration_SetsAlertAndExpiration(string alert, TimeSpan?expiration)
        {
            // Act
            ApplePushMessage apsNot = new ApplePushMessage(alert, expiration);

            // Assert
            Assert.Equal(alert, apsNot.Aps.Alert);
            if (expiration != null)
            {
                Assert.True(apsNot.Expiration.HasValue);
                Assert.True(DateTimeOffset.UtcNow < apsNot.Expiration);
            }
            else
            {
                Assert.Null(apsNot.Expiration);
            }
        }
Beispiel #6
0
        public void Serializes_AlertProperties()
        {
            ApplePushMessage apsNot = new ApplePushMessage();

            apsNot.Aps.AlertProperties.Body         = "Bob wants to play poker";
            apsNot.Aps.AlertProperties.ActionLocKey = "PLAY";
            apsNot.Aps.Badge = 5;
            apsNot["acme1"]  = "bar";
            apsNot["acme2"]  = new Collection <string> {
                "bang", "whiz"
            };

            // Act
            string actual = apsNot.ToString();

            // Assert
            Assert.Equal(Templates["AlertProperties"], actual);
        }