コード例 #1
0
        public void Convert_WithValueAndFactor_CorrectMultiplication(object value, double factor, double expected)
        {
            m_multiplicationConverter.Factor = factor;
            var actual = m_multiplicationConverter.Convert(value, null, null, null);

            actual.Should().Be(expected);
        }
コード例 #2
0
        public void Convert_WhenValueIsNotInt_ResultIs1()
        {
            var multiplicationConverter = new MultiplicationConverter();

            var result = multiplicationConverter.Convert(3.14, typeof(int), 3, null);

            Assert.AreEqual(1, result);
        }
コード例 #3
0
        public void Convert_WhenArgumentsAre3And3_ResultIs9()
        {
            var multiplicationConverter = new MultiplicationConverter();

            var result = multiplicationConverter.Convert(3, typeof(int), 3, null);

            Assert.AreEqual(9, result);
        }
コード例 #4
0
        public void Convert_WhenArgumentsAre2And4_ResultIs8()
        {
            var multiplicationConverter = new MultiplicationConverter();

            var result = multiplicationConverter.Convert(2, typeof(int), 4, null);

            Assert.AreEqual(8, result);
        }
コード例 #5
0
        public void Convert_WhenParameterIsNotInt_ReturnsValue()
        {
            var multiplicationConverter = new MultiplicationConverter();

            var result = multiplicationConverter.Convert(3, typeof(int), "", null);

            Assert.AreEqual(3, result);
        }