public void NotificationSecondaryTile_Serialization_IsConsistent() { // Arrange NotificationSecondaryTile testTile = new NotificationSecondaryTile { PushChannel = "myPushChannel", Tags = new List <string> { "tag1", "tag2" }, Templates = new Dictionary <string, NotificationTemplate> { { "templateName1", new NotificationTemplate { Body = "myTemplateBody", Headers = new Dictionary <string, string> { { "headerName1", "headerValue1" }, { "headerName2", "headerValue2" } } } } } }; // Assert SerializationAssert.VerifySerialization(testTile, "{\"pushChannel\":\"myPushChannel\",\"tags\":[\"tag1\",\"tag2\"],\"templates\":{\"templateName1\":{\"body\":\"myTemplateBody\",\"headers\":{\"headerName1\":\"headerValue1\",\"headerName2\":\"headerValue2\"},\"tags\":[]}}}"); }
public void Serialization_IsConsistent() { // Arrange TileText image = new TileText { Id = 1, Lang = "Lang", Text = "Test" }; // Assert SerializationAssert.VerifySerialization(image, "{\"id\":1,\"lang\":\"Lang\",\"text\":\"Test\"}"); }
public void Serialization_IsConsistent() { // Arrange TileImage image = new TileImage { Id = 1, Src = "Src", Alt = "Alt", AddImageQuery = true }; // Assert SerializationAssert.VerifySerialization(image, "{\"id\":1,\"src\":\"Src\",\"alt\":\"Alt\",\"addImageQuery\":true}"); }
public void Serialization_IsConsistent() { // Arrange Toast tile = new Toast { Parameter = "parameter", Text1 = "你好", Text2 = "世界", Version = "1.0", }; // Assert SerializationAssert.VerifySerialization(tile, "{\"text1\":\"你好\",\"text2\":\"世界\",\"parameter\":\"parameter\"}"); }
public void Serialization_IsConsistent() { // Arrange EntityDataMock data = new EntityDataMock() { Id = "你好世界", Version = Encoding.UTF8.GetBytes("version"), CreatedAt = DateTimeOffset.Parse("2013-10-07T21:55:45.8677285Z"), UpdatedAt = DateTimeOffset.Parse("2013-11-07T21:55:45.8677285Z"), Deleted = true }; // Act/Assert SerializationAssert.VerifySerialization(data, "{\"id\":\"你好世界\",\"version\":\"dmVyc2lvbg==\",\"createdAt\":\"2013-10-07T21:55:45.867Z\",\"updatedAt\":\"2013-11-07T21:55:45.867Z\",\"deleted\":true}"); }
public void Serialization_WithAlertString_IsConsistent() { // Arrange ApsProperties aps = new ApsProperties { Alert = "Alert", Badge = 0, Sound = "Sound", ContentAvailable = true, }; // Assert SerializationAssert.VerifySerialization(aps, "{\"alert\":\"Alert\",\"badge\":0,\"sound\":\"Sound\",\"content-available\":true}", new List <string> { "AlertProperties", "Item" }); }
public void NotificationTemplate_Serialization_IsConsistent() { // Arrange NotificationTemplate testTemplate = new NotificationTemplate { Body = "myBody", Headers = new Dictionary <string, string>() }; testTemplate.Headers["myHeader2Name"] = "myHeader2Value"; testTemplate.Headers["myHeader1Name"] = "myHeader1Value"; testTemplate.Headers["myHeader3Name"] = "myHeader3Value"; // Assert SerializationAssert.VerifySerialization(testTemplate, "{\"body\":\"myBody\",\"headers\":{\"myHeader2Name\":\"myHeader2Value\",\"myHeader1Name\":\"myHeader1Value\",\"myHeader3Name\":\"myHeader3Value\"},\"tags\":[]}"); }
public void Serialization_IsConsistent() { // Arrange AlertProperties alert = new AlertProperties { Body = "Body", ActionLocKey = "ActionLocKey", LocKey = "LocKey", LaunchImage = "LaunchImage" }; alert.LogArgs.Add("Arg"); // Assert SerializationAssert.VerifySerialization(alert, "{\"body\":\"Body\",\"action-loc-key\":\"ActionLocKey\",\"loc-key\":\"LocKey\",\"launch-image\":\"LaunchImage\",\"loc-args\":[\"Arg\"]}", new List <string> { "Item" }); }
public void Serialization_IsConsistent() { // Arrange VisualTile visual = new VisualTile { AddImageQuery = true, BaseUri = "BaseUri", Branding = "Branding", ContentId = "ContentId", Version = 2, Lang = "Lang", }; visual.Bindings.Add(new TileBinding()); // Assert SerializationAssert.VerifySerialization(visual, "{\"version\":2,\"lang\":\"Lang\",\"baseUri\":\"BaseUri\",\"branding\":\"Branding\",\"addImageQuery\":true,\"contentId\":\"ContentId\",\"bindings\":[{\"template\":null,\"fallback\":null,\"lang\":null,\"baseUri\":null,\"branding\":null,\"addImageQuery\":false,\"contentId\":null,\"images\":[],\"texts\":[]}]}"); }
public void Serializes_AsExpected() { // Arrange WebHook webHook = new WebHook { Description = "你好", Id = "1234567890", IsPaused = true, Secret = "世界", WebHookUri = new Uri("http://localhost/path"), }; webHook.Filters.Add("*"); webHook.Headers.Add(new KeyValuePair <string, string>("k1", "v1")); webHook.Properties.Add(new KeyValuePair <string, object>("p1", 1234)); // Act/Assert SerializationAssert.SerializesAs <WebHook>(webHook, _settings, "{\"Id\":\"1234567890\",\"WebHookUri\":\"http://localhost/path\",\"Secret\":\"世界\",\"Description\":\"你好\",\"IsPaused\":true,\"Filters\":[\"*\"],\"Headers\":{\"k1\":\"v1\"},\"Properties\":{\"p1\":1234}}"); }
public void NotificationInstallation_Serialization_IsConsistent() { // Arrange NotificationTemplate testSecondaryTemplate = new NotificationTemplate { Body = "mySecondaryBody", Headers = new Dictionary <string, string>() }; testSecondaryTemplate.Headers["mySecondaryHeaderName"] = "mySecondaryHeaderValue"; NotificationSecondaryTile testSecondaryTile = new NotificationSecondaryTile { PushChannel = "myPushChannel", Tags = new List <string>(), Templates = new Dictionary <string, NotificationTemplate>() }; testSecondaryTile.Tags.Add("myTag"); testSecondaryTile.Templates["mySecondaryTemplateName"] = testSecondaryTemplate; NotificationInstallation installation = new NotificationInstallation { PushChannel = "myPushChannel", Platform = "myPlatform", InstallationId = "myId", SecondaryTiles = new Dictionary <string, NotificationSecondaryTile>(), Templates = new Dictionary <string, NotificationTemplate>() }; installation.SecondaryTiles["myTestTile"] = testSecondaryTile; NotificationTemplate testTemplate = new NotificationTemplate { Body = "myBody", Headers = new Dictionary <string, string>() }; testSecondaryTemplate.Headers["myHeaderName"] = "myHeaderValue"; installation.Templates["myTemplateName"] = testTemplate; // Assert SerializationAssert.VerifySerialization(installation, "{\"pushChannel\":\"myPushChannel\",\"platform\":\"myPlatform\",\"installationId\":\"myId\",\"templates\":{\"myTemplateName\":{\"body\":\"myBody\",\"headers\":{},\"tags\":[]}},\"secondaryTiles\":{\"myTestTile\":{\"pushChannel\":\"myPushChannel\",\"tags\":[\"myTag\"],\"templates\":{\"mySecondaryTemplateName\":{\"body\":\"mySecondaryBody\",\"headers\":{\"mySecondaryHeaderName\":\"mySecondaryHeaderValue\",\"myHeaderName\":\"myHeaderValue\"},\"tags\":[]}}}},\"tags\":[]}"); }
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\"}"); }
public void Serialization_IsConsistent() { // Arrange FlipTile tile = new FlipTile { BackBackgroundImage = new Uri("http://localhost/path1"), BackContent = "back content", BackgroundImage = new Uri("http://localhost/path2"), BackTitle = "back title", Count = 10, Id = "id", SmallBackgroundImage = new Uri("http://localhost/path3"), Title = "title", Version = "2.0", WideBackBackgroundImage = new Uri("http://localhost/path4"), WideBackContent = "你好世界", WideBackgroundImage = new Uri("http://localhost/path5"), }; // Assert SerializationAssert.VerifySerialization(tile, "{\"smallBackgroundImage\":\"http://localhost/path3\",\"wideBackgroundImage\":\"http://localhost/path5\",\"wideBackBackgroundImage\":\"http://localhost/path4\",\"wideBackContent\":\"你好世界\",\"backgroundImage\":\"http://localhost/path2\",\"backBackgroundImage\":\"http://localhost/path1\",\"backTitle\":\"back title\",\"backContent\":\"back content\",\"id\":\"id\",\"count\":10,\"title\":\"title\"}"); }
public void Serialization_IsConsistent() { // Arrange CycleTile tile = new CycleTile { Count = 10, CycleImage1 = new Uri("http://localhost/path1"), CycleImage2 = new Uri("http://localhost/path2"), CycleImage3 = new Uri("http://localhost/path3"), CycleImage4 = new Uri("http://localhost/path4"), CycleImage5 = new Uri("http://localhost/path5"), CycleImage6 = new Uri("http://localhost/path6"), CycleImage7 = new Uri("http://localhost/path7"), CycleImage8 = new Uri("http://localhost/path8"), CycleImage9 = new Uri("http://localhost/path9"), Id = "id", SmallBackgroundImage = new Uri("http://localhost/path10"), Title = "title", Version = "2.0", }; // Assert SerializationAssert.VerifySerialization(tile, "{\"smallBackgroundImage\":\"http://localhost/path10\",\"cycleImage1\":\"http://localhost/path1\",\"cycleImage2\":\"http://localhost/path2\",\"cycleImage3\":\"http://localhost/path3\",\"cycleImage4\":\"http://localhost/path4\",\"cycleImage5\":\"http://localhost/path5\",\"cycleImage6\":\"http://localhost/path6\",\"cycleImage7\":\"http://localhost/path7\",\"cycleImage8\":\"http://localhost/path8\",\"cycleImage9\":\"http://localhost/path9\",\"id\":\"id\",\"count\":10,\"title\":\"title\"}"); }
public void Serialization_IsConsistent() { // Arrange TileBinding tile = new TileBinding { Template = "Template", Fallback = "Fallback", Lang = "Lang", BaseUri = "BaseUri", Branding = "Branding", AddImageQuery = true, ContentId = "ContentId" }; tile.Images.Add(new TileImage { Id = 1, Src = "Src", Alt = "Alt", AddImageQuery = true }); tile.Texts.Add(new TileText { Id = 1, Lang = "Lang", Text = "Test" }); // Assert SerializationAssert.VerifySerialization(tile, "{\"template\":\"Template\",\"fallback\":\"Fallback\",\"lang\":\"Lang\",\"baseUri\":\"BaseUri\",\"branding\":\"Branding\",\"addImageQuery\":true,\"contentId\":\"ContentId\",\"images\":[{\"id\":1,\"src\":\"Src\",\"alt\":\"Alt\",\"addImageQuery\":true}],\"texts\":[{\"id\":1,\"lang\":\"Lang\",\"text\":\"Test\"}]}"); }
public void Serialization_IsConsistent() { SerializationAssert.VerifySerialization(this.queryResult, "{\"results\":[1,2,3],\"count\":9223372036854775807}"); }
public void IsNotChangedAfterDeserialization() { SerializationAssert.IsNotChangedAfterDeserialized <BaseClassMockWithChildren>(); }
public void SerializesAndDeserializes() { SerializationAssert.SerializesAndDeserializes <BaseClassMockWithChildren>(); }
public void Serializes_AsExpected() { SerializationAssert.SerializesAs <CustomNotifications>(_notifications, _settings, "{\"Id\":\"123456\",\"Attempt\":1,\"Properties\":{\"pk1\":\"pv1\",\"pk2\":\"pv2\"},\"Notifications\":[{\"nk1\":\"nv1\"},{\"nk2\":\"nv2\"}]}"); }
public void Serializes_AsExpected() { SerializationAssert.SerializesAs(_queueContext, _settings, "{\"Receiver\":\"TestReceiver\",\"Id\":\"12345\",\"Actions\":[\"a1\",\"a2\"],\"Data\":{\"Prop1\":\"Hello\",\"Prop2\":\"World\"}}"); }
public void Serializes_AsExpected() { SerializationAssert.SerializesAs <PusherNotifications>(_notifications, _settings, "{\"time_ms\":34359738368,\"events\":[{\"k1\":\"v1\"},{\"k2\":\"v2\"},{\"k3\":\"v3\"}]}"); }