public void GoodHeaderId_ReturnsExpectedInactiveCount() { // arrange int expected = 0; int headerId = 1; IFavoriteListDetailsRepository repo = MakeRepo(); // act List <FavoritesListDetail> results = repo.GetFavoritesListDetails(headerId); // assert results.Count(f => f.Active == false) .Should() .Be(expected); }
public void NullLabel_ReturnsExpectedValue() { // arrange int detailId = 4; IFavoriteListDetailsRepository repo = MakeRepo(); // act FavoritesListDetail results = repo.GetFavoriteDetail(detailId); // assert results .Label .Should() .BeNull(); }
public void GoodDetail_ReturnsExpectedEach() { // arrange int detailId = 1; bool expected = true; IFavoriteListDetailsRepository repo = MakeRepo(); // act FavoritesListDetail results = repo.GetFavoriteDetail(detailId); // assert results .Each .Should() .Be(expected); }
public void GoodDetail_ReturnsExpectedCreatedUtc() { // arrange int detailId = 1; DateTime expected = new DateTime(2017, 6, 29, 16, 29, 0, DateTimeKind.Utc); IFavoriteListDetailsRepository repo = MakeRepo(); // act FavoritesListDetail results = repo.GetFavoriteDetail(detailId); // assert results .CreatedUtc .Should() .Be(expected); }
public void GoodDetail_SavesCorrectLineNumber() { // arrange FavoritesListDetail detail = MakeDetail(); int expected = 17; IFavoriteListDetailsRepository repo = MakeRepo(); // act long detailId = repo.SaveFavoriteListDetail(detail); FavoritesListDetail result = repo.GetFavoriteDetail(detailId); // assert result.LineNumber .Should() .Be(expected); }
public void GoodDetail_ReturnsExpectedCatalogId() { // arrange int detailId = 1; string expected = "FDF"; IFavoriteListDetailsRepository repo = MakeRepo(); // act FavoritesListDetail results = repo.GetFavoriteDetail(detailId); // assert results .CatalogId .Should() .Be(expected); }
public void GoodDetail_SavesCorrectLabel() { // arrange FavoritesListDetail detail = MakeDetail(); string expected = "Fake Label"; IFavoriteListDetailsRepository repo = MakeRepo(); // act long detailId = repo.SaveFavoriteListDetail(detail); FavoritesListDetail result = repo.GetFavoriteDetail(detailId); // assert result.Label .Should() .Be(expected); }
public void GoodDetail_SavesCorrectEach() { // arrange FavoritesListDetail detail = MakeDetail(); bool expected = true; IFavoriteListDetailsRepository repo = MakeRepo(); // act long detailId = repo.SaveFavoriteListDetail(detail); FavoritesListDetail result = repo.GetFavoriteDetail(detailId); // assert result.Each .Should() .Be(expected); }
public void GoodDetail_DoesNotUseSetModifiedUtc() { // arrange FavoritesListDetail detail = MakeDetail(); DateTime expected = new DateTime(2017, 6, 30, 8, 48, 0, DateTimeKind.Utc); IFavoriteListDetailsRepository repo = MakeRepo(); // act long detailId = repo.SaveFavoriteListDetail(detail); FavoritesListDetail result = repo.GetFavoriteDetail(detailId); // assert result.ModifiedUtc .Should() .NotBe(expected); }
public void GoodDetail_ReturnsExpectedLineNumber() { // arrange int detailId = 1; int expected = 1; IFavoriteListDetailsRepository repo = MakeRepo(); // act FavoritesListDetail results = repo.GetFavoriteDetail(detailId); // assert results .LineNumber .Should() .Be(expected); }
public void GoodDetail_DeletesCorrectDetail() { // arrange FavoritesListDetail detail = MakeDetail(); IFavoriteListDetailsRepository repo = MakeRepo(); // act long detailId = repo.SaveFavoriteListDetail(detail); repo.DeleteFavoriteListDetail(detailId); FavoritesListDetail results = repo.GetFavoriteDetail(detailId); // assert results.Active .Should() .BeFalse(); }
public void NullItemNumber_ShouldThrowSqlException() { // arrange FavoritesListDetail detail = new FavoritesListDetail { Active = true, CatalogId = "FAT", CreatedUtc = new DateTime(2017, 6, 30, 8, 47, 0, DateTimeKind.Utc), Each = true, HeaderId = 1, Label = "Fake Label", LineNumber = 17, ModifiedUtc = new DateTime(2017, 6, 30, 8, 48, 0, DateTimeKind.Utc) }; IFavoriteListDetailsRepository repo = MakeRepo(); // act Action act = () => { repo.SaveFavoriteListDetail(detail); }; // assert act.Should().Throw <SqlException>(); }
public void NullLabel_SavesExpectedValue() { // arrange FavoritesListDetail detail = new FavoritesListDetail { Active = true, CatalogId = "FAT", CreatedUtc = new DateTime(2017, 6, 30, 8, 47, 0, DateTimeKind.Utc), Each = true, HeaderId = 1, ItemNumber = "123456", LineNumber = 17, ModifiedUtc = new DateTime(2017, 6, 30, 8, 48, 0, DateTimeKind.Utc) }; IFavoriteListDetailsRepository repo = MakeRepo(); // act long detailId = repo.SaveFavoriteListDetail(detail); FavoritesListDetail results = repo.GetFavoriteDetail(detailId); // assert results.Label .Should() .BeNull(); }
public FavoritesListLogicImpl(IFavoriteListDetailsRepository detailRepository, IFavoriteListHeadersRepository headerRepository) { _detailRepo = detailRepository; _headerRepo = headerRepository; }