Skip to content

Repository files navigation

Specification pattern

This code is base on Eric Evans and Martin Fowler's article introducing the Specification pattern

Simple example in the tests can be found here UserPreviouslyActiveIsPartOfTheRecentlyInactiveCohort.cs

ISpecification<UserContext>inactiveCohort=newUserIsInactiveForOverTwoWeeks().And(newUserHasViewedSomeThing()).And(newUserHasUploadedSomeThing()).And(newUserHasNotReceivedAReportThisMonth());varuserContext=newUserContext{LastActiveDate=DateTime.UtcNow.AddDays(-15),LastReportSent=DateTime.UtcNow.AddMonths(-1),TotalUploads=10,TotalViews=50};booluserInCohort=inactiveCohort.IsSatisfiedBy(userContext)

In this series

  1. All about security
  2. The power of Composite Specifications
  3. Specifications 3: The DSL Strikes Back
  4. Knock knock. Who's there? AbstractSpecificationNodeVisitorImpl

About

C# implementation of the specification pattern

Resources

Stars

24 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages