AirTransmissionLibrary/tests/AirTransmission.Tests/AtmosphericTransmittanceCalculatorTests.cs

29 lines
929 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Xunit;
namespace AirTransmission.Tests;
public class AtmosphericTransmittanceCalculatorTests
{
[Fact]
public void CalcLaser_WithValidInput_ReturnsExpectedResult()
{
// Arrange
var weather = new WeatherCondition(
WeatherType., // 天气类型
temperature: 20, // 温度(℃)
relativeHumidity: 45, // 相对湿度
visibility: 10, // 能见度(公里)
precipitation: 0 // 降雨量(mm/h)
);
double distance = 1; // 1公里
// Act
double result = AtmosphericTransmittanceCalculator.CalcLaser(weather, distance);
Console.WriteLine($"计算得到的透过率为: {result}");
// Assert
Assert.True(result > 0 && result <= 1);
Assert.True(result > 0.5); // 在晴朗天气下1公里距离的透过率应该大于0.5
}
}