Giter VIP home page Giter VIP logo

conventional's Introduction

Conventional Build status

A suite of convention tests to run over sets of types or whole solutions to make sure your duckies are all in a row.

To install from NuGet

Install-Package Best.Conventional 

Sample Usage

Standard Syntax

new[] { typeof(MyType), typeof(MyOtherType) }
    .MustConformTo(
        Convention.PropertiesMustHavePublicGetters.And(
        Convention.PropertiesMustHavePublicSetters))
    .WithFailureAssertion(Assert.Fail);

Fluent Syntax

new[] { typeof(MyType), typeof(MyOtherType) }
    .MustConformTo(Convention.PropertiesMustHavePublicGetters)
    .AndMustConformTo(Convention.PropertiesMustHavePublicSetters)
    .WithFailureAssertion(Assert.Fail);

Or Mix It Up!

new[] { typeof(MyType), typeof(MyOtherType) }
    .MustConformTo(
        Convention.PropertiesMustHavePublicGetters.And(
        Convention.PropertiesMustHavePublicSetters))
    .AndMustConformTo(Convention.MustHaveADefaultConstructor)
    .WithFailureAssertion(Assert.Fail);

Supplied Conventions

  • Properties must have public getters
  • Properties must have public setters
  • Properties must have protected setters
  • Properties must have private setters
  • Name must start with
  • Name must end with
  • Must live in namespace
  • Must have a default constructor
  • Must have a default non-public constructor
  • Must have appropriate constructors
  • Must have attribute
  • Must not take a dependency on
  • Requires a corresponding implementation of (T)
  • Enumerable properties must be eager loaded
  • Collection properties must be immutable
  • All properties must be immutable
  • Must not use DateTime.Now
  • Must not use DateTimeOffset.Now
  • Exceptions thrown must be derived from specified type
  • Must instantiate properties of specified type in default constructor
  • All properties must be instantiated during construction

Supplied Conventions (.Net 4.5 Only)

  • Void methods must not be async
  • Async methods must have 'Async' suffix
  • Libraries should call Task.ConfigureAwait(false) to prevent deadlocks

Solution Convention Sample Usage

Standard Syntax

ThisSolution
    .MustConformTo(Convention.MustOnlyContainToDoAndNoteComments)
    .WithFailureAssertion(Assert.Fail);

Supplied Solution Conventions

  • Must only contain Todo and Note comments
  • Must only contain informative comments

2015-04-07 0.1.x Release Breaking Changes

  • The Conventional.Async assembly has been merged into the core Conventional assembly, and async conventions are now accessed through the same Convention class as the core conventions.

  • The Conventional.Cecil assembly has been merged into the core Conventional assembly, and Mono.Cecil based conventions are now accessed through the same Convention class as the core conventions.

The aim of these changes was to simplify usage of Conventional - there is now one central location for conventions, and only one package regardless of the conventions you wish to enforce. The only side effect of the changes is the core package is now dependent on Mono.Cecil.

conventional's People

Contributors

andrewabest avatar michael-wolfenden avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.