Пример #1
0
        public List <ListItemModel> GetNotes(UserProfile user, UserSelectedContext catalogInfo)
        {
            NotesListHeader header = _headerRepo.GetHeadersForCustomer(catalogInfo);

            List <ListItemModel> notes = new List <ListItemModel>();

            if (header != null)
            {
                var notedetails = _detailRepo.GetAll(header.Id);
                notes = notedetails.Select(d => d.ToWebModel())
                        .ToList();
            }

            return(notes);
        }
Пример #2
0
            public void GoodDetail_ReturnsProperCount() {
                // arrange
                int expected = 4;
                INotesDetailsListRepository repo = MakeRepo();

                // act
                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details.Count()
                       .Should()
                       .Be(expected);
            }
Пример #3
0
            public void GoodDetail_ReturnsExpectedEach() {
                // arrange
                bool expected = true;
                INotesDetailsListRepository repo = MakeRepo();

                // act
                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details.First(x => x.ItemNumber.Equals(GOOD_ITEM_NUMBER))
                       .Each
                       .Should()
                       .Be(expected);
            }
Пример #4
0
            public void GoodDetail_ReturnsExpectedCreatedDate() {
                // arrange
                DateTime expected = new DateTime(2017, 7, 3, 11, 33, 0, DateTimeKind.Utc);
                INotesDetailsListRepository repo = MakeRepo();

                // act
                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details.First(x => x.ItemNumber.Equals(GOOD_ITEM_NUMBER))
                       .CreatedUtc
                       .Should()
                       .Be(expected);
            }
Пример #5
0
            public void GoodDetail_ReturnsExpectedCatalogId() {
                // arrange
                string expected = "FDF";
                INotesDetailsListRepository repo = MakeRepo();

                // act
                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details.First(x => x.ItemNumber.Equals(GOOD_ITEM_NUMBER))
                       .CatalogId
                       .Should()
                       .Be(expected);
            }
Пример #6
0
            public void GoodDetail_HeaderIdMatchesExpected() {
                // arrange
                int expected = 1;
                INotesDetailsListRepository repo = MakeRepo();

                // act
                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details[0]
                        .HeaderId
                        .Should()
                        .Be(expected);
            }
Пример #7
0
            public void GoodDetail_NewLineNumberSavesCorrectly() {
                // arrange
                int expected = 2;
                INotesDetailsListRepository repo = MakeRepo();

                // act
                repo.Save(MakeDetail());
                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details.First(x => x.ItemNumber.Equals(NEW_ITEM_NUMBER))
                       .LineNumber
                       .Should()
                       .Be(expected);
            }
Пример #8
0
            public void GoodDetail_DoesNotSaveSetModifiedDate() {
                // arrange
                DateTime expected = new DateTime(2017, 7, 3, 14, 47, 0, DateTimeKind.Utc);
                INotesDetailsListRepository repo = MakeRepo();

                // act
                repo.Save(MakeDetail());
                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details.First(x => x.ItemNumber.Equals(NEW_ITEM_NUMBER))
                       .ModifiedUtc
                       .Should()
                       .NotBe(expected);
            }
Пример #9
0
            public void PartialDetail_ReturnsNullEach() {
                // arrange
                INotesDetailsListRepository repo = MakeRepo();

                // act
                NotesListDetail detail = MakeDetail();
                detail.Each = null;
                repo.Save(detail);

                List<NotesListDetail> details = repo.GetAll(GOOD_HEADER_ID);

                // assert
                details.First(x => x.ItemNumber.Equals(NEW_ITEM_NUMBER))
                       .Each
                       .Should()
                       .BeNull();
            }