From 337e86a667024a78873b874aea0ff48b05898b6c Mon Sep 17 00:00:00 2001 From: hayakawa Date: Thu, 8 Aug 2024 11:27:20 -0700 Subject: [PATCH] Added a unit test to check warning output. Check it out! --- .../ForwardSolvers/DiffusionParametersTests.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Vts.Test/Unit/Modeling/ForwardSolvers/DiffusionParametersTests.cs b/src/Vts.Test/Unit/Modeling/ForwardSolvers/DiffusionParametersTests.cs index b4178d12..a4bdd15e 100644 --- a/src/Vts.Test/Unit/Modeling/ForwardSolvers/DiffusionParametersTests.cs +++ b/src/Vts.Test/Unit/Modeling/ForwardSolvers/DiffusionParametersTests.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using NUnit.Framework; using Vts.Modeling.ForwardSolvers; @@ -44,7 +45,15 @@ public void Validate_Create_method_results() Assert.IsTrue(Math.Abs(1.01 - diffusionParameters.mutr) < 1e-6); Assert.IsTrue(Math.Abs(1.947246 - diffusionParameters.zb) < 1e-6); Assert.IsTrue(Math.Abs(0.552486 - diffusionParameters.zp) < 1e-6); - // add test to test warning + // add test to test warning if Mua >= Musp + ops = new OpticalProperties(1.0, 1.0, 0.8, 1.4); + var output = new StringWriter(); + Console.SetOut(output); + diffusionParameters = DiffusionParameters.Create( + ops, + ForwardModel.SDA); + Assert.IsTrue(diffusionParameters != null); + Assert.That(output.ToString(), Is.EqualTo("Warning: Mua >= Musp\r\n")); } ///