コード例 #1
0
ファイル: ListExtensionTests.cs プロジェクト: ikhramts/NNX
 public void MultiplyInPlace_IfMultiplierIsNaN_ThrowArgumentException()
 {
     var target = new[] { new[] { 0.1, 0.2 }, new[] { 0.3 } };
     const double multiplier = double.NaN;
     Action action = () => target.MultiplyInPlace(multiplier);
     action.ShouldThrow<ArgumentException>()
         .WithMessage("*Argument 'multiplier' cannot be NaN.*")
         .Where(e => e.ParamName == "multiplier");
 }
コード例 #2
0
ファイル: ListExtensionTests.cs プロジェクト: ikhramts/NNX
        public void MultiplyInPlace_ShouldMultiply()
        {
            var target = new[] { new[] { 0.1, 0.2 }, new[] { 0.3 } };
            var multiplier = 2.0;
            var expected = new[] { new[] { 0.2, 0.4 }, new[] { 0.6 } };

            target.MultiplyInPlace(multiplier);
            target.Should().NotBeNullOrEmpty();
            target.Should().HaveCount(2);
            target[0].ShouldApproximatelyEqual(expected[0]);
            target[1].ShouldApproximatelyEqual(expected[1]);
        }