コード例 #1
0
        public void Add_NegativeInputNumbers_NegativesNotAllowedExceptionThrown()
        {
            NegativesNotAllowedException ex =
                Assert.Throws <NegativesNotAllowedException>(() => calculator.Add("1,-2,3,4,-5"));

            Assert.That(ex.Message, Is.EqualTo("Negatives not allowed. There are negative numbers: -2, -5"));
        }
コード例 #2
0
        public void ItHandlesMultipleNegatives()
        {
            var expectedException = new NegativesNotAllowedException(-1, -2, -3);

            var actualException = Assert.Throws <NegativesNotAllowedException>(() => this.adder.Add("-1,-2,-3"));

            Assert.That(actualException.Message, Is.EqualTo(expectedException.Message));
        }