private void UpdateSnapshots_Click(object sender, RoutedEventArgs e) { var snapshot = snapshotCreator.CreateSnapshot(); XMLExportTextBlock.Text = xmlExporter.CreateFormattedXMLString(snapshot, ShowNullAndEmptyValuesCheckbox.IsChecked.Value, IncludeNamespacesCheckbox.IsChecked.Value); JSONExportTextBlock.Text = jsonExporter.CreateFormattedJSONString(snapshot, ShowNullAndEmptyValuesCheckbox.IsChecked.Value, IncludeNamespacesCheckbox.IsChecked.Value); }
public void VerifyButtonFormattedJSONExportWithoutNamespacesWithNullValues() { App.Content = new Button() { RequestedTheme = Windows.UI.Xaml.ElementTheme.Light }; var exporter = new JsonExporter(new StandardObjectToStringConverter()); var snapshotCreator = new ElementSnapshotCreator(StandardOptions.StandardPropertyNames, App.Content); var exportFormatted = exporter.CreateFormattedJSONString(snapshotCreator.CreateSnapshot(), true, false); var expected = @"{ ""type"": ""Button"", ""Name"": """", ""Visibility"": ""Visible"", ""Margin"": ""0,0,0,0"", ""Padding"": ""8,4,8,5"", ""Background"": ""#33000000"", ""BorderBrush"": ""#00FFFFFF"", ""BorderThickness"": ""2,2,2,2"", ""Foreground"": ""#FF000000"", ""children"": [ { ""type"": ""ContentPresenter"", ""Name"": ""ContentPresenter"", ""Visibility"": ""Visible"", ""Margin"": ""0,0,0,0"", ""Padding"": ""8,4,8,5"", ""Background"": ""#33000000"", ""BorderBrush"": ""#00FFFFFF"", ""BorderThickness"": ""2,2,2,2"", ""Foreground"": ""#FF000000"", ""children"": [] } ] }"; Assert.AreEqual(expected, exportFormatted); }