示例#1
0
        public void GivenAnIndividualAndASubsectionOfAnImageInput_WhenTheTwoAreConvolutedAndTheSubsectionIsBigger_ItShouldThrowAnDifferingConvolutionSizeExceptionError()
        {
            double[] position = new double[] { 6.0, 2.0 };

            double[] subSection = { 1, 5, 3 };

            DotProductConvolutionStrategy convolutionStrategy = new DotProductConvolutionStrategy();

            Assert.That(() => convolutionStrategy.Calculate(subSection, position),
                        Throws.TypeOf <DifferingConvolutionSizeException>());
        }
示例#2
0
        public void GivenAnIndividualAndASubsectionOfAnImageInput_WhenTheTwoAreConvolutedAndHaveThreeDimensions_ItShouldReturnTheDotProduct()
        {
            double[] position = new double[] { 6.0, 2.0, 3.0 };

            double[] subSection = { 1, 5, 7 };

            DotProductConvolutionStrategy convolutionStrategy = new DotProductConvolutionStrategy();

            double result = convolutionStrategy.Calculate(subSection, position);

            Assert.AreEqual(37, result);
        }