Esempio n. 1
0
        public ListItemModel GetNote(UserSelectedContext catalogInfo, string itemNumber)
        {
            ListItemModel   returnValue = null;
            NotesListHeader header      = _headerRepo.GetHeadersForCustomer(catalogInfo);

            if (header != null)
            {
                var noteDetail = _detailRepo.Get(header.Id, itemNumber);
                returnValue = noteDetail?.ToWebModel();
            }

            return(returnValue);
        }
Esempio n. 2
0
            public void BadContext_BadBranchIdReturnsNull()
            {
                // arrange
                UserSelectedContext context = new UserSelectedContext()
                {
                    CustomerId = "654321",
                    BranchId   = "XXX"
                };
                INotesHeadersListRepository repo = MakeRepo();

                // act
                NotesListHeader results = repo.GetHeadersForCustomer(context);

                // assert
                results.Should()
                .BeNull();
            }
Esempio n. 3
0
            public void BadContext_BadCustomerNumberReturnsNull()
            {
                // arrange
                UserSelectedContext context = new UserSelectedContext()
                {
                    CustomerId = "654321",
                    BranchId   = "FRT"
                };
                UserSelectedContext         expected = null;
                INotesHeadersListRepository repo     = MakeRepo();

                // act
                var results = repo.GetHeadersForCustomer(context);

                // assert
                results
                .Should()
                .Be(expected);
            }
Esempio n. 4
0
            public void GoodContext_ReturnsExpectedBranchId()
            {
                // arrange
                UserSelectedContext context = new UserSelectedContext()
                {
                    CustomerId = "123456",
                    BranchId   = "FRT"
                };
                INotesHeadersListRepository repo = MakeRepo();

                string expected = "FRT";

                // act
                NotesListHeader results = repo.GetHeadersForCustomer(context);

                // assert
                results
                .BranchId
                .Should()
                .Be(expected);
            }
Esempio n. 5
0
            public void GoodContext_ReturnsExpectedCreatedUtc()
            {
                // arrange
                DateTime expected = new DateTime(2017, 6, 30, 16, 11, 0, DateTimeKind.Utc);

                UserSelectedContext context = new UserSelectedContext()
                {
                    CustomerId = "123456",
                    BranchId   = "FRT"
                };

                INotesHeadersListRepository repo = MakeRepo();

                // act
                NotesListHeader results = repo.GetHeadersForCustomer(context);

                // assert
                results
                .CreatedUtc
                .Should()
                .Be(expected);
            }
Esempio n. 6
0
            public void GoodHeader_SavesCorrectCustomerNumber()
            {
                // arrange
                string expected = "200321";

                UserSelectedContext context = new UserSelectedContext()
                {
                    CustomerId = "200321",
                    BranchId   = "FRT"
                };

                NotesListHeader             header = MakeHeader();
                INotesHeadersListRepository repo   = MakeRepo();

                // act
                var headerId = repo.Save(header);
                var results  = repo.GetHeadersForCustomer(context);

                // assert
                results.CustomerNumber
                .Should()
                .Be(expected);
            }
Esempio n. 7
0
            public void GoodHeader_DoesNotUseSetModifiedUtc()
            {
                // arrange
                DateTime expected = new DateTime(2017, 6, 30, 16, 33, 0, DateTimeKind.Utc);

                UserSelectedContext context = new UserSelectedContext()
                {
                    CustomerId = "200321",
                    BranchId   = "FRT"
                };

                NotesListHeader             header = MakeHeader();
                INotesHeadersListRepository repo   = MakeRepo();

                // act
                var headerId = repo.Save(header);
                var results  = repo.GetHeadersForCustomer(context);

                // assert
                results.ModifiedUtc
                .Should()
                .NotBe(expected);
            }