コード例 #1
0
        public void JsonPayload_TakesOverSerialization()
        {
            // Arrange
            GooglePushMessage gcmNot = new GooglePushMessage()
            {
                JsonPayload = "text"
            };

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

            // Assert
            Assert.Equal("text", actual);
        }
コード例 #2
0
        public void Serializes_Demo()
        {
            // Arrange
            GooglePushMessage gcmNot = new GooglePushMessage();

            gcmNot.CollapseKey    = "demo";
            gcmNot.DelayWhileIdle = true;
            gcmNot.Data.Add("key1", "value1");
            gcmNot.Data.Add("key2", "value2");
            gcmNot.TimeToLiveInSeconds = 3;

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

            // Assert
            Assert.Equal(Templates["Demo"], actual);
        }
コード例 #3
0
        public void GooglePushMessage_DataTimeToLive_SetsDataAndTimeToLive(IDictionary <string, string> data, TimeSpan?timeToLive)
        {
            // Act
            GooglePushMessage gcmNot = new GooglePushMessage(data, timeToLive);

            // Assert
            foreach (string dataKey in data.Keys)
            {
                Assert.Equal(data[dataKey], gcmNot.Data[dataKey]);
            }

            if (timeToLive != null)
            {
                Assert.Equal(timeToLive.Value.TotalSeconds, gcmNot.TimeToLiveInSeconds.Value);
            }
            else
            {
                Assert.Null(gcmNot.TimeToLiveInSeconds);
            }
        }