C# - Collection Validator Library
$30-250 USD
Betales ved levering
The aim of this project is to build a simple open source library to validate collections of objects. It can incorporate open source solutions such FluentValidation and the likes, and must be fully unit tested and follow stylecop standards.
I intend to make this project open source once it is complete. The best way to describe this project is by an example.
The way I would like to use this library would be like this (The code below is only intended to give you an idea of what I am after.):
var stringCollection = new List();
// Add some strings to the list here.
CollectionValidator myStringCollectionValidator = new CollectionValidator();
[login to view URL]().CountGreaterThan(3).CountLessThan(10);
var collectionValidationResults = [login to view URL](stringCollection);
For a collection of objects which is made up of multiple fields:
class myObject
{
public int ID {get;set;}
public string FirstName {get;set;}
public string LastName {get;set;}
}
var myObjectCollection = new List();
// Add some myObjects to the collection
// The myObjectValidator will validate each myObject in the collection.
CollectionValidator myObjectCollectionValidator = new CollectionValidator(myObjectValidator);
[login to view URL](x => [login to view URL]).Unique(x => [login to view URL], x => [login to view URL]).CountGreaterOrEqualTo(3);
var collectionValidationResults = [login to view URL](myObjectCollection);
The Unique() test will be overloaded to accept a variable or not. If it does not accept a variable it will simply check that all objects in the collection are unique. If it finds a duplicate, the index will be recorded.
If the Unique() test accepts a variable then the Property or the field of the Object needs to be checked for uniqueness.
If you have any questions please feel free to ask.
Prosjekt-ID: #4036488