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); }
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(); }
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); }
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); }
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); }
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); }
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); }