public void WasteComposition_MinNotLessThanMax_ValidationError() { var viewModel = GetValidViewModel(); var wasteType1 = new WoodInformationData(); wasteType1.MinConcentration = "30"; wasteType1.MaxConcentration = "20"; var wasteType2 = new WoodInformationData(); wasteType2.MinConcentration = "10"; wasteType2.MaxConcentration = "20"; viewModel.WasteComposition = new List <WoodInformationData> { wasteType1, wasteType2 }; viewModel.Energy = "energy"; var result = ValidateViewModel(viewModel); Assert.NotEmpty(result); Assert.True(result.First().ErrorMessage.StartsWith("The minimum concentration level should be lower than the maximum concentration")); }
public void ValidViewModel_Validates() { var viewModel = GetValidViewModel(); var otherType = new WoodInformationData(); otherType.MaxConcentration = "20"; otherType.MinConcentration = "3"; otherType.Constituent = "type"; var wasteType = new WoodInformationData(); wasteType.MaxConcentration = "20"; wasteType.MinConcentration = "3"; viewModel.WasteComposition = new List <WoodInformationData> { wasteType }; viewModel.Energy = "energy"; var result = ValidateViewModel(viewModel); Assert.Empty(result); }
private void AssertEquality(WoodInformationData expected, WasteAdditionalInformation actual) { Assert.Equal(expected.WasteInformationType, actual.WasteInformationType); Assert.Equal(Convert.ToDecimal(expected.MinConcentration), actual.MinConcentration); Assert.Equal(Convert.ToDecimal(expected.MaxConcentration), actual.MaxConcentration); Assert.Equal(expected.Constituent, actual.Constituent); }
public string ConstituentUnits(WoodInformationData woodInformationData) { var units = "%"; if (woodInformationData.WasteInformationType == WasteInformationType.HeavyMetals || woodInformationData.WasteInformationType == WasteInformationType.NetCalorificValue) { units = string.Empty; } return(units); }
public string ConstituentUnits(WoodInformationData woodInformationData) { var units = "%"; if (woodInformationData.WasteInformationType == WasteInformationType.HeavyMetals || woodInformationData.WasteInformationType == WasteInformationType.NetCalorificValue) { units = string.Empty; } return units; }
public string ConstituentTitle(WoodInformationData woodInformationData) { var name = woodInformationData.Constituent; if (woodInformationData.WasteInformationType == WasteInformationType.HeavyMetals) { name = name + " (" + Views.ChemicalComposition.ParametersResources.Milligrams.Replace(" ", " ") + ")"; } if (woodInformationData.WasteInformationType == WasteInformationType.NetCalorificValue) { name = name + " (" + Views.ChemicalComposition.ParametersResources.Megajoules.Replace(" ", " ") + ")"; } return(name); }
public string ConstituentTitle(WoodInformationData woodInformationData) { var name = woodInformationData.Constituent; if (woodInformationData.WasteInformationType == WasteInformationType.HeavyMetals) { name = name + " (" + Views.ChemicalComposition.ParametersResources.Milligrams.Replace(" ", " ") + ")"; } if (woodInformationData.WasteInformationType == WasteInformationType.NetCalorificValue) { name = name + " (" + Views.ChemicalComposition.ParametersResources.Megajoules.Replace(" ", " ") + ")"; } return name; }
public void WasteComposition_NoMinValues_ValidationError() { var viewModel = GetValidViewModel(); var wasteType = new WoodInformationData(); wasteType.MaxConcentration = "20"; viewModel.WasteComposition = new List <WoodInformationData> { wasteType }; viewModel.Energy = "energy"; var result = ValidateViewModel(viewModel); Assert.NotEmpty(result); Assert.True(result.First().ErrorMessage.StartsWith("Please enter a minimum and maximum concentration")); }
public void WasteComposition_NaAndNumber_ValidationError(string minValue, string maxValue) { var viewModel = GetValidViewModel(); var wasteType = new WoodInformationData(); wasteType.MaxConcentration = maxValue; wasteType.MinConcentration = minValue; viewModel.WasteComposition = new List <WoodInformationData> { wasteType }; viewModel.Energy = "energy"; var result = ValidateViewModel(viewModel); Assert.NotEmpty(result); Assert.True(result.First().ErrorMessage.StartsWith("Both fields must either contain 'NA' or a number")); }
public void WasteCodes_MaxPercentageNotValid_ValidationError(string value) { var viewModel = GetValidViewModel(); var wasteType = new WoodInformationData(); wasteType.MinConcentration = "2"; wasteType.MaxConcentration = value; viewModel.WasteComposition = new List <WoodInformationData> { wasteType }; viewModel.Energy = "energy"; var result = ValidateViewModel(viewModel); Assert.NotEmpty(result); Assert.True(result.First().ErrorMessage.StartsWith("The maximum concentration should be in range from 0 to 100")); }
public void AllValues_NA_ValidationError() { var viewModel = GetValidViewModel(); var wasteType = new WoodInformationData(); wasteType.MaxConcentration = "na"; wasteType.MinConcentration = "na"; viewModel.WasteComposition = new List <WoodInformationData> { wasteType }; viewModel.Energy = "energy"; var result = ValidateViewModel(viewModel); Assert.NotEmpty(result); Assert.True(result.First().ErrorMessage.StartsWith("You have not entered any data about the waste's composition")); }
public void WoodWithDescription_Validates() { var viewModel = GetValidViewModel(); viewModel.ChemicalCompositionType = ChemicalComposition.Wood; viewModel.Description = "description"; var wasteType = new WoodInformationData(); wasteType.MinConcentration = "30"; wasteType.MaxConcentration = "50"; wasteType.Constituent = "type"; viewModel.WasteComposition = new List <WoodInformationData> { wasteType }; var result = ValidateViewModel(viewModel); Assert.Empty(result); }
private static bool IsPercentageQuantity(WoodInformationData wasteData) { return wasteData.WasteInformationType != WasteInformationType.HeavyMetals && wasteData.WasteInformationType != WasteInformationType.NetCalorificValue; }
private static bool IsPercentageQuantity(WoodInformationData wasteData) { return(wasteData.WasteInformationType != WasteInformationType.HeavyMetals && wasteData.WasteInformationType != WasteInformationType.NetCalorificValue); }