Visual studio 2013: Contract.Assume not generating exception at runtime?


hello guys.

i must missing something, can't see what. i'm creating new assembly .net 4.5.2 , i've enabled code contracts going project properties , doing following:

* set assembly mode standard contract requires

* enabled perform runtime contract checking

* chose option full on combo

* , chose build option contract reference assembly @ end of page

then, i've added folloowing existing class:

                        

namespace domain.persistence {
    public abstract class valueobject : base {
        protected valueobject() {
            var anyinvalidprops = gettype().getproperties()
                .where(p => attribute.isdefined(p, typeof (domainsignatureattribute), true))
                .any();

            contract.assume(!anyinvalidprops);

        }
    }
}

while running unit tests, don't end getting exception (even when condition false!). clues on i'm missing?



luis abreu

solved it: had set public surface contracts checkbox mistake , cosntructor protected...

luis abreu



DevLabs  >  Code Contracts



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'