Пример #1
0
        public void ShouldAddDoubles()
        {
            var result = sut_Calculator.AddDoubles(1.1, 2.2);

            //Assert.That(result, Is.EqualTo(3.3)); floats vary so we need to build in tolerance
            Assert.That(result, Is.EqualTo(3.3).Within(0.01));
        }
        public void ShouldAddDoubles()
        {
            var sut    = new Calculator();
            var result = sut.AddDoubles(1.1, 2.2);

            Assert.That(result, Is.EqualTo(3.3).Within(0.1));
        }
        public void ShouldAddDoubles_WithPercentageBadTolerance()
        {
            var sut    = new Calculator();
            var result = sut.AddDoubles(1.1, 2.2);

            Assert.That(result, Is.EqualTo(30).Within(100).Percent);
        }
        public void ShouldAddDoubles_WithPercentageTolerance()
        {
            var sut    = new Calculator();
            var result = sut.AddDoubles(50, 50);

            Assert.That(result, Is.EqualTo(101).Within(1).Percent);
        }
Пример #5
0
        public void ShouldAddDoubleValues()
        {
            var sut = new Calculator();

            var result = sut.AddDoubles(1.1, 2.2);

            Assert.Equal(3.3, result, 1);
        }