Skip to content

Enum support and Contract conversions

Compare
Choose a tag to compare
@SergeyTeplyakov SergeyTeplyakov released this 01 Jul 19:50
· 78 commits to master since this release

New features

  • Added combo action that convert if-throw precondition check to Contract.Requires (both - gneric and non-generic versions);
  • Added combo action that convert between generic and non-generic Contract.Requires

Requires: Requires for enum (#1)

  • Added combo action that adds precondition check for enums and nullable enums with Contract.Requires(Enum.IsDefined(typeof(SomeEnumType), someEnumValue));
  • Added combo action that adds postcondition check that enum and nullable enum result is defined by Enum.IsDefiined method.

Binaries at R# Gallery

https://resharper-plugins.jetbrains.com/packages/ReSharper.ContractExtensions/0.7.51

Demo

Convert null-check preconditions from if-throw to Contract.Requires

Convert range check from if-throw to Contract.Requires

Add precondition check for enum argument

Add postcondition check for enum argument