public void CreatePending_QuoteItemPrepared_DomainValidationExceptionThrown() { var id = Guid.NewGuid(); var jobItemId = _jobItemForCreatePendingId; _quoteItemForCreatePending.Status = new ListItem { Id = Guid.NewGuid(), Name = "Quote Prepared", Type = ListItemType.StatusQuotedPrepared, Category = new ListItemCategory { Id = Guid.NewGuid(), Name = "Job Item Status", Type = ListItemCategoryType.JobItemStatus } }; _invoiceItemService = InvoiceItemServiceFactory.Create( _userContext, MockRepository.GenerateStub <ICompanyDetailsRepository>(), MockRepository.GenerateStub <IInvoiceRepository>(), InvoiceItemRepositoryTestHelper.GetInvoiceItemRepository_StubsJobItemHasPendingInvoiceItem_ReturnsFalse(jobItemId), JobItemRepositoryTestHelper.GetJobItemRepository_StubsGetById_ReturnsJobItem(_jobItemForCreatePending), QuoteItemRepositoryTestHelper.GetQuoteItemRepository_StubsGetQuoteItemForJobItem_ReturnsQuoteItem(jobItemId, _quoteItemForCreatePending), MockRepository.GenerateStub <IListItemRepository>()); CreatePending(id, jobItemId); Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.QuoteStatusInvalid)); }
public void CreatePending_InvalidJobItemId_ArgumentExceptionThrown() { var id = Guid.NewGuid(); var jobItemId = Guid.NewGuid(); _invoiceItemService = InvoiceItemServiceFactory.Create( _userContext, MockRepository.GenerateStub <ICompanyDetailsRepository>(), MockRepository.GenerateStub <IInvoiceRepository>(), InvoiceItemRepositoryTestHelper.GetInvoiceItemRepository_StubsJobItemHasPendingInvoiceItem_ReturnsFalse(jobItemId), JobItemRepositoryTestHelper.GetJobItemRepository_StubsGetById_ReturnsNull(jobItemId), QuoteItemRepositoryTestHelper.GetQuoteItemRepository_StubsGetQuoteItemForJobItem_ReturnsQuoteItem(jobItemId, _quoteItemForCreatePending), MockRepository.GenerateStub <IListItemRepository>()); CreatePending(id, jobItemId); }
public void CreatePending_UserHasInsufficientSecurityClearance_DomainValidationExceptionThrown() { var id = Guid.NewGuid(); var jobItemId = _jobItemForCreatePendingId; _invoiceItemService = InvoiceItemServiceFactory.Create( TestUserContext.Create("*****@*****.**", "Graham Robertson", "Operations Manager", UserRole.Public), MockRepository.GenerateStub <ICompanyDetailsRepository>(), MockRepository.GenerateStub <IInvoiceRepository>(), InvoiceItemRepositoryTestHelper.GetInvoiceItemRepository_StubsJobItemHasPendingInvoiceItem_ReturnsFalse(jobItemId), JobItemRepositoryTestHelper.GetJobItemRepository_StubsGetById_ReturnsJobItem(_jobItemForCreatePending), QuoteItemRepositoryTestHelper.GetQuoteItemRepository_StubsGetQuoteItemForJobItem_ReturnsQuoteItem(jobItemId, _quoteItemForCreatePending), MockRepository.GenerateStub <IListItemRepository>()); CreatePending(id, jobItemId); Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.InsufficientSecurityClearance)); }
public void CreatePending_QuoteItemNotRaised_DomainValidationExceptionThrown() { var id = Guid.NewGuid(); var jobItemId = _jobItemForCreatePendingId; _invoiceItemService = InvoiceItemServiceFactory.Create( _userContext, MockRepository.GenerateStub <ICompanyDetailsRepository>(), MockRepository.GenerateStub <IInvoiceRepository>(), InvoiceItemRepositoryTestHelper.GetInvoiceItemRepository_StubsJobItemHasPendingInvoiceItem_ReturnsFalse(jobItemId), JobItemRepositoryTestHelper.GetJobItemRepository_StubsGetById_ReturnsJobItem(_jobItemForCreatePending), QuoteItemRepositoryTestHelper.GetQuoteItemRepository_StubsGetQuoteItemForJobItem_ReturnsNull(jobItemId), MockRepository.GenerateStub <IListItemRepository>()); CreatePending(id, jobItemId); Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.QuoteItemNull)); }