Example #1
0
        internal void CalculateAnlog_CorrectlyCalculatesTheZCoefficient_TesT(
            int order, [Frozen] Mock <IPolesCoefficientsFactory> polesCoefficientFactory,
            ButterworthAnalog butterworthAnalog)
        {
            butterworthAnalog.CalculateAnalog(order);

            polesCoefficientFactory.Verify(
                mock => mock.Build(It.IsAny <double>(), It.IsAny <IReadOnlyList <Complex> >(), new List <Complex>()),
                Times.Once);
        }
Example #2
0
        internal void CalculateAnalog_SetsTheCoefficientsPropertyToTheBuiltCoefficients_Test(
            int order, [Frozen] Mock <IPolesCoefficientsFactory> polesCoefficientsFactory,
            IPolesCoefficients polesCoefficients, ButterworthAnalog butterworthAnalog)
        {
            polesCoefficientsFactory.Setup(
                mock =>
                mock.Build(It.IsAny <double>(), It.IsAny <IReadOnlyList <Complex> >(),
                           It.IsAny <IReadOnlyList <Complex> >())).Returns(polesCoefficients);

            butterworthAnalog.CalculateAnalog(order);

            Assert.Equal(polesCoefficients, butterworthAnalog.Coefficients);
        }
Example #3
0
        internal void CalculateAnalog_CorrectlyCalculatesThePCoefficient_Test(
            int order, [Frozen] Mock <IPolesCoefficientsFactory> polesCoefficientsFactory,
            ButterworthAnalog butterworthAnalog)
        {
            var expected = new List <Complex>();

            var start = -order + 1;

            for (var i = 0; i < order; i++, start += 2)
            {
                expected.Add(-Complex.Exp(new Complex(0.0d, 1.0d) * Math.PI * start / (2 * order)));
            }

            butterworthAnalog.CalculateAnalog(order);

            polesCoefficientsFactory.Verify(
                mock => mock.Build(It.IsAny <double>(), expected, It.IsAny <IReadOnlyList <Complex> >()), Times.Once);
        }
Example #4
0
 internal void CalculateAnalog_ThrowsExceptionIfOrderIsLessThanOne_Test(
     int order, ButterworthAnalog butterworthAnalog)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => butterworthAnalog.CalculateAnalog(order));
 }