public IHttpActionResult GetDecks() { try { List <DeckDTO> decks = catalog.GetAllDecks().ToList(); return(Ok(decks)); } catch (ArgumentNullException ex) { var message = $"Decks collection is empty. {ex.Message}"; return(BadRequest(message)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void GetAllDecksTest() { var sut = new CatalogBll(this.catalog.Object, this.converter.Object); var actual = sut.GetAllDecks(); this.catalog.Verify( cat => cat.GetAllDecks(), Times.Exactly(1)); Assert.That(actual, Is.All.InstanceOf(typeof(DeckDTO))); Assert.AreEqual(decks.Count, actual.Count()); }