public List<BoardGame> getBoardGame(BoardGameSettings settings, params int[] gameIDs) { string requestUrl = builder.buildBoardGameUrl(settings, gameIDs); XDocument result = XDocument.Load(requestUrl); return parser.parseBoardGameXML(result); }
public void boardgame_WithReturnComments_ReturnsComments() { // Arrange IBGGClient client = new BGGXMLClient(); BoardGameSettings settings = new BoardGameSettings() { commSets = commentSettings.fetch }; // Act List<BoardGame> result = client.getBoardGame(settings, 98778); // Assert Assert.IsTrue(result[0].comments.Count > 0); }
public void boardGameURL_WithCurrentStatsSettings_ReturnsUrl() { // Arrange IUrlBuilder testBuilder = new UrlBuilder(); BoardGameSettings settings = new BoardGameSettings() { commSets = commentSettings.none, statSets = statsSettings.current }; string expected = "http://www.boardgamegeek.com/xmlapi/boardgame/12345?comments=0&stats=1"; // Act string result = testBuilder.buildBoardGameUrl(settings, 12345); // Assert Assert.AreEqual(expected, result); }
public void boardgame_WithReturnStats_StatsAreReturned() { // Arrange IBGGClient client = new BGGXMLClient(); BoardGameSettings settings = new BoardGameSettings() { statSets = statsSettings.current }; // Act List<BoardGame> result = client.getBoardGame(settings, 98778); // Assert Assert.IsTrue(result[0].statistics.Count > 0); }
public void boardgame_WithReturnHistory_HistoricStatsAreReturned() { // Arrange IBGGClient client = new BGGXMLClient(); BoardGameSettings settings = new BoardGameSettings() { statSets = statsSettings.histroic, historicStatsFrom = new DateTime(2013, 01, 01), historicStatsTo = new DateTime(2013, 07, 01) }; // Act List<BoardGame> result = client.getBoardGame(settings, 103885); // Assert Assert.IsTrue(result[0].statistics.Count > 1); }
public void boardGameURL_WithHistoricStatsAndFromDate_ReturnsUrl() { // Arrange IUrlBuilder testBuilder = new UrlBuilder(); BoardGameSettings settings = new BoardGameSettings() { commSets = commentSettings.none, statSets = statsSettings.histroic, historicStatsFrom = new DateTime(2011, 01, 02) }; string toDate = DateTime.Now.ToString("yyyy-MM-dd"); string expected = "http://www.boardgamegeek.com/xmlapi/boardgame/12345?comments=0&historical=1&from=2011-01-02&to=" + toDate; // Act string result = testBuilder.buildBoardGameUrl(settings, 12345); // Assert Assert.AreEqual(expected, result); }
public void boardGameURL_WithHistoricStatsSettings_ReturnsUrl() { // Arrange IUrlBuilder testBuilder = new UrlBuilder(); BoardGameSettings settings = new BoardGameSettings() { commSets = commentSettings.none, statSets = statsSettings.histroic, historicStatsFrom = new DateTime(2012, 01, 21), historicStatsTo = new DateTime(2013, 02, 26) }; string expected = "http://www.boardgamegeek.com/xmlapi/boardgame/12345?comments=0&historical=1&from=2012-01-21&to=2013-02-26"; // Act string result = testBuilder.buildBoardGameUrl(settings, 12345); // Assert Assert.AreEqual(expected, result); }