public int AddNewQuotation(DomainEntities.Quotation quotation) { var validationResult = _quotationValidator.Validate(quotation); var objectToAdd = _quotationMapper.Map(quotation); if (validationResult.IsValid) { _nHibernateQuotationUniversalRepository.Create(objectToAdd); } else { throw new System.Exception("błędy walidacji"); } return(objectToAdd.Id); }
public void when_validate_correct_quotation_then_method_should_not_return_error() { DateTime date = DateTime.Now; date = date.AddDays(-1); var fakeQuotationObject = CreateFakeQuotation(date, 1, 10, 5, 1, 1, 1); var validationResult = quotationValidator.Validate(fakeQuotationObject); Assert.AreEqual(validationResult.IsValid, true); }