private async void BeUniqueByProductAssemblyIDComponentIDStartDate_Create_Not_Exists() { Mock <IBillOfMaterialRepository> billOfMaterialRepository = new Mock <IBillOfMaterialRepository>(); billOfMaterialRepository.Setup(x => x.ByProductAssemblyIDComponentIDStartDate(It.IsAny <int?>(), It.IsAny <int>(), It.IsAny <DateTime>())).Returns(Task.FromResult <BillOfMaterial>(null)); var validator = new ApiBillOfMaterialRequestModelValidator(billOfMaterialRepository.Object); await validator.ValidateCreateAsync(new ApiBillOfMaterialRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ComponentID, 1); }
public async void UnitMeasureCode_Create_length() { Mock <IBillOfMaterialRepository> billOfMaterialRepository = new Mock <IBillOfMaterialRepository>(); billOfMaterialRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new BillOfMaterial())); var validator = new ApiBillOfMaterialRequestModelValidator(billOfMaterialRepository.Object); await validator.ValidateCreateAsync(new ApiBillOfMaterialRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.UnitMeasureCode, new string('A', 4)); }