SergeyTeplyakov / ReSharperContractExtensions

Set of extensions for R# that simplifies Design by Contract programming using Code Contracts.
MIT License
69 stars 10 forks source link

Warn for using Contract.Requires/Contract.Ensures in inner statements #22

Closed SergeyTeplyakov closed 10 years ago

SergeyTeplyakov commented 10 years ago
public class MalformedContractWithVoidMethod
{
    public void Foo(string s)
    {
        // error CC1017: Malformed contract section in method 'Sample.Foo(System.String)'
        switch (s)
        {
            case "foo":
                Contract.Requires(false);
                break;
        }
    }
}
SergeyTeplyakov commented 10 years ago

image