public void Writes_error_for_anything_else() { // Arrange var formatter = BuildFormatter(); var stream = new MemoryStream(); // Act var resource = new Color { Id = "1", Name = "Blue" }; formatter.WriteToStreamAsync(resource.GetType(), resource, stream, null, null).Wait(); // Assert TestHelpers.StreamContentsMatchFixtureContents(stream, "Json/Fixtures/JsonApiFormatter/Writes_error_for_anything_else.json"); }
/// <summary> /// Handles initialization of the GameScreen. This will be invoked after the GameScreen has been /// completely and successfully added to the ScreenManager. It is highly recommended that you /// use this instead of the constructor. This is invoked only once. /// </summary> public override void Initialize() { base.Initialize(); topForm = new Form(GUIManager, new Vector2(5, 5), new Vector2(700, 550)) { Text = "Primary form" }; var tb = new TextBox(topForm, new Vector2(10, 10), new Vector2(150, 300)); _textBox = new TextBox(topForm, new Vector2(350, 10), new Vector2(200, 200)) { Font = GUIManager.Font, Text = "abcdef\nghi\r\njklj\n" }; for (var i = 0; i < 150; i++) { var c = new Color((byte)rnd.Next(0, 256), (byte)rnd.Next(256), (byte)rnd.Next(256), 255); _textBox.Append(new StyledText(i + " ", c)); } var styledTexts = new List<StyledText> { new StyledText("Black ", Color.Black), new StyledText("Red ", Color.Red), new StyledText("Green ", Color.Green), new StyledText("Yellow ", Color.Yellow), new StyledText("Voilet ", Color.Violet), new StyledText("Orange ", Color.Orange), new StyledText("Tomato ", Color.Tomato), new StyledText("DarkRed ", Color.DarkRed), }; tb.Append(styledTexts); var form = new Form(topForm, new Vector2(50, 50), new Vector2(200, 200)) { Text = "My form" }; var b = new Button(form, new Vector2(20, 20), new Vector2(80, 30)) { Text = "Press me" }; b.Clicked += b_Clicked; new CheckBox(form, new Vector2(20, 200)) { Text = "Checkbox" }; var f2 = new Form(topForm, new Vector2(200, 250), new Vector2(275, 270)) { Text = "My form 2" }; var f3 = new Form(f2, Vector2.Zero, new Vector2(200, 200)) { Text = "form 3" }; var f4 = new Form(f3, Vector2.Zero, new Vector2(100, 100)) { Text = "form 4" }; var testLabelF4 = new Label(f4, Vector2.Zero) { Text = "Click me" }; testLabelF4.Clicked += testLabelF4_Clicked; _dragLbl = new Label(topForm, topForm.Size - new Vector2(75, 30)); topForm.BeginDrag += DragControl; topForm.EndDrag += DragControl; form.BeginDrag += DragControl; form.EndDrag += DragControl; f2.BeginDrag += DragControl; f2.EndDrag += DragControl; f3.BeginDrag += DragControl; f3.EndDrag += DragControl; f4.BeginDrag += DragControl; f4.EndDrag += DragControl; // Set up the tooltips foreach (var c in GUIManager.GetAllControls()) { if (c.GetType() == typeof(Button)) c.Tooltip = Tooltip_Button; else if (c.GetType() == typeof(Label)) c.Tooltip += Tooltip_Label; } // Paged list var items = new List<string>(); for (var i = 0; i < 100; i++) { items.Add(i.ToString()); } new ListBox<string>(topForm, new Vector2(500, 250), new Vector2(100, 100)) { Items = items, ShowPaging = true }; }