public void GoodHeader_ReturnsGoodHeaderId() { // arrange int expected = 4; MandatoryItemsListHeader header = MakeHeader(); IMandatoryItemsListHeadersRepository repo = MakeRepo(); // act long headerId = repo.SaveMandatoryItemsHeader(header); // assert headerId.Should() .Be(expected); }
public void NullCustomerNumber_ThrowsSqlException() { // arrange MandatoryItemsListHeader header = new MandatoryItemsListHeader { BranchId = "FRT", CreatedUtc = new DateTime(2017, 6, 30, 16, 32, 0, DateTimeKind.Utc), ModifiedUtc = new DateTime(2017, 6, 30, 16, 33, 0, DateTimeKind.Utc) }; IMandatoryItemsListHeadersRepository repo = MakeRepo(); // act Action act = () => { repo.SaveMandatoryItemsHeader(header); }; // assert act.Should().Throw <SqlException>(); }
public void BadContext_BadBranchIdReturnsNull() { // arrange UserSelectedContext context = new UserSelectedContext() { CustomerId = "654321", BranchId = "XXX" }; IMandatoryItemsListHeadersRepository repo = MakeRepo(); // act MandatoryItemsListHeader results = repo.GetListHeaderForCustomer(context); // assert results.Should() .BeNull(); }
public void BadContext_BadCustomerNumberReturnsNull() { // arrange UserSelectedContext context = new UserSelectedContext() { CustomerId = "654321", BranchId = "FRT" }; UserSelectedContext expected = null; IMandatoryItemsListHeadersRepository repo = MakeRepo(); // act var results = repo.GetListHeaderForCustomer(context); // assert results .Should() .Be(expected); }
public void GoodContext_ReturnsExpectedBranchId() { // arrange UserSelectedContext context = new UserSelectedContext() { CustomerId = "123456", BranchId = "FRT" }; IMandatoryItemsListHeadersRepository repo = MakeRepo(); string expected = "FRT"; // act MandatoryItemsListHeader results = repo.GetListHeaderForCustomer(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" }; IMandatoryItemsListHeadersRepository repo = MakeRepo(); // act MandatoryItemsListHeader results = repo.GetListHeaderForCustomer(context); // assert results .CreatedUtc .Should() .Be(expected); }
public void GoodHeader_SavesCorrectCustomerNumber() { // arrange string expected = "200321"; UserSelectedContext context = new UserSelectedContext() { CustomerId = "200321", BranchId = "FRT" }; MandatoryItemsListHeader header = MakeHeader(); IMandatoryItemsListHeadersRepository repo = MakeRepo(); // act var headerId = repo.SaveMandatoryItemsHeader(header); var results = repo.GetListHeaderForCustomer(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" }; MandatoryItemsListHeader header = MakeHeader(); IMandatoryItemsListHeadersRepository repo = MakeRepo(); // act var headerId = repo.SaveMandatoryItemsHeader(header); var results = repo.GetListHeaderForCustomer(context); // assert results.ModifiedUtc .Should() .NotBe(expected); }
public MandatoryItemsListLogicImpl(IMandatoryItemsListHeadersRepository headersRepo, IMandatoryItemsListDetailsRepository detailsRepo) { _headersRepo = headersRepo; _detailsRepo = detailsRepo; }