Exemplo n.º 1
0
            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);
            }
Exemplo n.º 2
0
            public void NullLabel_ReturnsExpectedValue()
            {
                // arrange
                int detailId = 4;
                IFavoriteListDetailsRepository repo = MakeRepo();

                // act
                FavoritesListDetail results = repo.GetFavoriteDetail(detailId);

                // assert
                results
                .Label
                .Should()
                .BeNull();
            }
Exemplo n.º 3
0
            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);
            }
Exemplo n.º 4
0
            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);
            }
Exemplo n.º 5
0
            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);
            }
Exemplo n.º 6
0
            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);
            }
Exemplo n.º 7
0
            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);
            }
Exemplo n.º 8
0
            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);
            }
Exemplo n.º 9
0
            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);
            }
Exemplo n.º 10
0
            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);
            }
Exemplo n.º 11
0
            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();
            }
Exemplo n.º 12
0
            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>();
            }
Exemplo n.º 13
0
            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();
            }
Exemplo n.º 14
0
 public FavoritesListLogicImpl(IFavoriteListDetailsRepository detailRepository, IFavoriteListHeadersRepository headerRepository)
 {
     _detailRepo = detailRepository;
     _headerRepo = headerRepository;
 }