public void validate_default() { MachineViewModel viewModel = new MachineViewModel(); var result = viewModel.Validate(null); Assert.True(0 < result.Count()); }
public void Validate_ViewModel() { MachineViewModel vm = new MachineViewModel() { Code = "code", Condition = "condition", Electric = 1, LPG = 1, MachineEvents = new List <MachineEventViewModel>() { new MachineEventViewModel() { Name = "name", No = "no" } }, MachineType = new MachineTypeViewModel() { Indicators = new List <MachineTypeIndicatorsViewModel>() { new MachineTypeIndicatorsViewModel() { DataType = "datatype", DefaultValue = "default", Indicator = "indicatpr", Uom = "uom" } }, Description = "description", Name = "name" }, Manufacture = "manufacture", MonthlyCapacity = 1, Name = "name", Process = "process", Solar = 1, Steam = 1, Steps = new List <StepViewModel>() { new StepViewModel() { Alias = "alias", Process = "process", ProcessArea = "area", StepIndicators = new List <StepIndicatorViewModel>() { new StepIndicatorViewModel() { Name = "name", Uom = "uom", Value = "value" } } } }, Unit = new UnitViewModel() { Name = "name", Division = new DivisionViewModel() { Name = "name" } }, Water = 1, Year = 2019 }; Assert.Empty(vm.Validate(null)); MachineViewModel vm2 = new MachineViewModel(); Assert.NotEmpty(vm2.Validate(null)); }