Ejemplo n.º 1
0
        public void IfEnumNotDefinedSuccess()
        {
            // ARRANGE
            var contractor = new Contractor
            {
                Type = ContractorType.Company
            };

            // ACT
            Fail.IfEnumNotDefined <ContractorType>(contractor.Type);
        }
Ejemplo n.º 2
0
        public void IfEnumNotDefined()
        {
            // ARRANGE
            var contractor = new Contractor
            {
                Type = 0
            };

            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfEnumNotDefined(contractor.Type)
                );

            // ASSERT
            Assert.That(exception, Is.Not.Null);
            Assert.That(exception.Message, Is.EqualTo("Unsupported enum value: 0 (ContractorType)"));
        }