Skip to content

Instantly share code, notes, and snippets.

@joeybeninghove
Created October 28, 2009 03:17
Show Gist options
  • Save joeybeninghove/220207 to your computer and use it in GitHub Desktop.
Save joeybeninghove/220207 to your computer and use it in GitHub Desktop.
public class AddNewAssetTypeSelectionViewValidator : Validator<IAddNewAssetTypeSelectionView>
{
public AddNewAssetTypeSelectionViewValidator(SiteDeviceConfig siteDeviceConfig)
{
RegisterValidation(new Validation<IAddNewAssetTypeSelectionView>()
.ValidateThat(view => view.AssetClassificationList.HasProductCodeSelected())
.When(() => siteDeviceConfig.ShowProductCode)
.WithMessage(Resources.ProductCode, Resources.ProductCodeNotSelected));
RegisterValidation(new Validation<IAddNewAssetTypeSelectionView>()
.ValidateThat(view => view.AssetClassificationList.HasAssetTypeSelected())
.When(() => !siteDeviceConfig.ShowProductCode)
.WithMessage(Resources.AssetType, Resources.AssetTypeNotSelected));
RegisterValidation(new Validation<IAddNewAssetTypeSelectionView>()
.ValidateThat(view => view.OwnershipList.HasItemSelected)
.WithMessage(Resources.Ownership, Resources.OwnershipNotSelected));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment