コード例 #1
0
            public void ShouldReturnCorrectResult()
            {
                var    problem = new Problem0001();
                object result  = problem.GetResult();

                result.Should().Be(233168);
            }
コード例 #2
0
        public void TwoSum_FourInputElements_CorrectResult()
        {
            var problem1 = new Problem0001();
            var input    = new int[] { 2, 7, 11, 15 };
            var expected = new int[] { 0, 1 };

            var result = problem1.TwoSum(input, 9);

            Assert.AreEqual(expected, result);
        }
コード例 #3
0
        public void TwoSum_ThreeInputElements_CorrectResult()
        {
            var problem1 = new Problem0001();
            var input    = new int[] { 3, 2, 4 };
            var expected = new int[] { 1, 2 };

            var result = problem1.TwoSum(input, 6);

            Assert.AreEqual(expected, result);
        }
コード例 #4
0
        public void TwoSum_TwoIdenticalConsecutiveElements_CorrectResult()
        {
            var problem1 = new Problem0001();
            var input    = new int[] { 2, 5, 5, 11 };
            var expected = new int[] { 1, 2 };

            var result = problem1.TwoSum(input, 10);

            Assert.AreEqual(expected, result);
        }
コード例 #5
0
 public void Problem0001Test()
 {
     Trace.WriteLine(Problem0001.Solution());//233168
 }