C# - Collection Validator Library

This project was successfully completed by fostreak for $35 USD in 3 days.

Get free quotes for a project like this
Employer working
Completed by:
Project Budget
$30 - $250 USD
Completed In
3 days
Total Bids
Project Description

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();
[url removed, login to view]().CountGreaterThan(3).CountLessThan(10);

var collectionValidationResults = [url removed, login to view](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);

[url removed, login to view](x => [url removed, login to view]).Unique(x => [url removed, login to view], x => [url removed, login to view]).CountGreaterOrEqualTo(3);

var collectionValidationResults = [url removed, login to view](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.

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online