public void LessThanOk()
        {
            const string parameterName = "parameterName";

            try
            {
                InternalContract.RequireLessThan(10, 1, parameterName);
            }
            catch (Exception e)
            {
                Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail($"Expected no exception but got {e.Message}.");
            }
        }
示例#2
0
        public void LessThanOk()
        {
            const string parameterName = "parameterName";

            try
            {
                InternalContract.RequireLessThan(10, 1, parameterName);
            }
            catch (Exception e)
            {
                UT.Assert.Fail($"Expected no exception but got {e.Message}.");
            }
        }
        public void LessThanFail()
        {
            const string parameterName = "parameterName";

            try
            {
                InternalContract.RequireLessThan(1, 1, parameterName);
                Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail("An exception should have been thrown");
            }
            catch (FulcrumContractException fulcrumException)
            {
                Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(fulcrumException.TechnicalMessage.Contains(parameterName));
            }
            catch (Exception e)
            {
                Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail($"Expected a specific FulcrumException but got {e.GetType().FullName}.");
            }
        }