public void SetUp() { this.particleGenerator = new Mock <IParticleGenerator>(); this.particleGenerator.Setup(foo => foo.Generate(It.IsAny <int>(), It.IsAny <float>(), It.IsAny <float>())).Returns <int, float, float>((par, min, max) => Enumerable.Repeat(min, par).ToArray()); this.particleAmount = 5; this.controller = new CircularParticleController(this.particleGenerator.Object, this.particleAmount); this.minValue = this.controller.MinValue; this.maxValue = this.controller.MaxValue; }
public void TestWeightedAverageZeroWeights() { float[] values = { 270f, 90f }; float[] weights = { 0f, 0f }; Mock <IParticleGenerator> pargen = new Mock <IParticleGenerator>(); pargen.Setup(foo => foo.Generate(It.IsAny <int>(), this.minValue, this.maxValue)).Returns(values); CircularParticleController cont = new CircularParticleController(pargen.Object, values.Length) { Weights = weights }; Assert.AreEqual(float.NaN, cont.WeightedAverage()); }