PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/Ducksboard.Tests/ClientTests.cs

https://github.com/khalidabuhakmeh/Ducksboard
C# | 52 lines | 45 code | 7 blank | 0 comment | 0 complexity | f7cdce98e4ee6074879ebf9a1f51215e MD5 | raw file
  1. using System.Net;
  2. using Ducksboard.Objects;
  3. using FluentAssertions;
  4. using Xunit;
  5. namespace Ducksboard.Tests
  6. {
  7. public class ClientTests
  8. {
  9. public ClientTests()
  10. {
  11. Dashboard = new DucksboardClient("** Your API Key Here **");
  12. }
  13. private DucksboardClient Dashboard { get; set; }
  14. [Fact]
  15. public void Can_update_a_number_widget()
  16. {
  17. var response = Dashboard.Update("** Widget **", new Numbers { Value = 0 });
  18. response.StatusCode.Should().Be(HttpStatusCode.OK);
  19. }
  20. [Fact]
  21. public void Can_update_an_image_widget()
  22. {
  23. var response = Dashboard.Update("** Widget **", new Image("http://i.telegraph.co.uk/multimedia/archive/01452/fer1_1452403i.jpg", "Ferrari"));
  24. response.StatusCode.Should().Be(HttpStatusCode.OK);
  25. }
  26. [Fact]
  27. public void Can_update_a_timeline_widget()
  28. {
  29. var timeline = new Timeline();
  30. timeline.Value.Title = "Checkout this Ferrari 458";
  31. timeline.Value.Image = "http://i.telegraph.co.uk/multimedia/archive/01452/fer1_1452403i.jpg";
  32. timeline.Value.Content = "Vroooooooom!";
  33. timeline.Value.Link =
  34. "http://www.telegraph.co.uk/motoring/car-manufacturers/ferrari/5931105/Ferrari-458-photo-gallery.html";
  35. var response = Dashboard.Update("** Widget **", timeline);
  36. response.StatusCode.Should().Be(HttpStatusCode.OK);
  37. }
  38. [Fact]
  39. public void Can_pass_in_many_numbers_to_a_graph()
  40. {
  41. var response = Dashboard.Updates("** Widget **", new[] { new Numbers { Value = 3 }, new Numbers { Value = 4 } });
  42. response.StatusCode.Should().Be(HttpStatusCode.OK);
  43. }
  44. }
  45. }