Example #1
0
        public void Serializes_IconicTileEmpty()
        {
            // Arrange
            IconicTile      tile        = new IconicTile();
            MpnsPushMessage pushMessage = new MpnsPushMessage(tile);

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

            // Assert
            Assert.Equal(Templates["IconicTileEmpty"], actual);
        }
 private void WriteIconicTile(JsonWriter writer, IconicTile tile)
 {
     writer
     .StartObject()
     .WriteProperty("tiletemplate", "iconic")
     .WriteProperty("tileid", tile.TileId, true)
     .WriteProperty("title", tile.FrontTitle, true)
     .WriteProperty("iconimage", tile.IconImage, true)
     .WriteProperty("smalliconimage", tile.SmallIconImage, true)
     .WriteProperty("backgroundcolor", tile.BackgroundColor, true)
     .WriteProperty("widecontent1", tile.WideContent1, true)
     .WriteProperty("widecontent2", tile.WideContent2, true)
     .WriteProperty("widecontent3", tile.WideContent3, true)
     .EndObject();
 }
        public void Serialization_IsConsistent()
        {
            // Arrange
            IconicTile tile = new IconicTile
            {
                BackgroundColor = "background color",
                Count           = 10,
                IconImage       = new Uri("http://localhost/path1"),
                Id             = "id",
                SmallIconImage = new Uri("http://localhost/path2"),
                WideContent1   = "wide content1",
                WideContent2   = "wide content2",
                WideContent3   = "wide content3",
                Title          = "title",
                Version        = "2.0",
            };

            // Assert
            SerializationAssert.VerifySerialization(tile, "{\"iconImage\":\"http://localhost/path1\",\"smallIconImage\":\"http://localhost/path2\",\"wideContent1\":\"wide content1\",\"wideContent2\":\"wide content2\",\"wideContent3\":\"wide content3\",\"backgroundColor\":\"background color\",\"id\":\"id\",\"count\":10,\"title\":\"title\"}");
        }
Example #4
0
        public void Serializes_IconicTile()
        {
            // Arrange
            IconicTile tile = new IconicTile()
            {
                Id              = "TileID",
                Count           = 100,
                IconImage       = new Uri("http://localhost/some/path/1"),
                SmallIconImage  = new Uri("/some/path/2", UriKind.Relative),
                WideContent1    = "WideContent1",
                WideContent2    = "WideContent2",
                WideContent3    = "WideContent3",
                BackgroundColor = "color",
                Title           = "你好世界"
            };
            MpnsPushMessage pushMessage = new MpnsPushMessage(tile);

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

            // Assert
            Assert.Equal(Templates["IconicTile"], actual);
        }
 private void WriteIconicTile(JsonWriter writer, IconicTile tile)
 {
     writer
         .StartObject()
         .WriteProperty("tiletemplate", "iconic")
         .WriteProperty("tileid", tile.TileId, true)
         .WriteProperty("title", tile.FrontTitle, true)
         .WriteProperty("iconimage", tile.IconImage, true)
         .WriteProperty("smalliconimage", tile.SmallIconImage, true)
         .WriteProperty("backgroundcolor", tile.BackgroundColor, true)
         .WriteProperty("widecontent1", tile.WideContent1, true)
         .WriteProperty("widecontent2", tile.WideContent2, true)
         .WriteProperty("widecontent3", tile.WideContent3, true)
         .EndObject();
 }