Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将“beapproximaly”与在循环的每次迭代中更改的值一起使用? 描述 我正在迭代两个列表 我想比较列表中每个点的2个值 我希望值彼此之间的偏差在0.1%以内 完成再现问题的最小示例 var sheetRows=新列表{-24.0,0.1,10}; var负载=新列表{-24.0,0.1,10.05}; sheetRows.Zip中的foreach((var xl,var db)(加载,(n,w)=>(n,w))) { xl.Should()近似为(db,db*0.001f); } 预期行为:_C#_Fluent Assertions - Fatal编程技术网

C# 如何将“beapproximaly”与在循环的每次迭代中更改的值一起使用? 描述 我正在迭代两个列表 我想比较列表中每个点的2个值 我希望值彼此之间的偏差在0.1%以内 完成再现问题的最小示例 var sheetRows=新列表{-24.0,0.1,10}; var负载=新列表{-24.0,0.1,10.05}; sheetRows.Zip中的foreach((var xl,var db)(加载,(n,w)=>(n,w))) { xl.Should()近似为(db,db*0.001f); } 预期行为:

C# 如何将“beapproximaly”与在循环的每次迭代中更改的值一起使用? 描述 我正在迭代两个列表 我想比较列表中每个点的2个值 我希望值彼此之间的偏差在0.1%以内 完成再现问题的最小示例 var sheetRows=新列表{-24.0,0.1,10}; var负载=新列表{-24.0,0.1,10.05}; sheetRows.Zip中的foreach((var xl,var db)(加载,(n,w)=>(n,w))) { xl.Should()近似为(db,db*0.001f); } 预期行为:,c#,fluent-assertions,C#,Fluent Assertions,通过 实际行为: 版本 您使用的是哪种版本的Fluent断言 最近的 您的目标是哪个.NET运行时和版本?例如.NET framework 4.6.1或.NET Core 2.1 运行NUnit的.NET Core 3.1传递的精度为负值。这很可能不起作用。您传递的精度值为负值。这很可能行不通。@DTul,我知道这很管用。我想要每个值的偏差。i、 e.浮点值只有6到8位,因此如果它是10000,另一个是0.001,那么每个值的10%是不同的@DTul,我知道这很有效。我想要每个值的偏差。

通过

实际行为: 版本
  • 您使用的是哪种版本的Fluent断言
最近的

  • 您的目标是哪个.NET运行时和版本?例如.NET framework 4.6.1或.NET Core 2.1

运行NUnit的.NET Core 3.1

传递的精度为负值。这很可能不起作用。

您传递的精度值为负值。这很可能行不通。

@DTul,我知道这很管用。我想要每个值的偏差。i、 e.浮点值只有6到8位,因此如果它是10000,另一个是0.001,那么每个值的10%是不同的@DTul,我知道这很有效。我想要每个值的偏差。i、 e.浮点值只有6到8位,因此如果它是10000,另一个是0.001,那么每个值的10%是不同的!谢谢就这样。。表明在流畅的断言中需要参数验证谢谢。就这样。。表明在流畅的断言中需要参数验证
Expected xl to approximate -24F +/- -0.024F, but -24F differed by 0F.
   at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message)
   at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args)
   at FluentAssertions.NumericAssertionsExtensions.FailIfDifferenceOutsidePrecision[T](Boolean differenceWithinPrecision, NumericAssertions`1 parent, T expectedValue, T precision, T actualDifference, String because, Object[] becauseArgs)
   at FluentAssertions.NumericAssertionsExtensions.BeApproximately(NumericAssertions`1 parent, Single expectedValue, Single precision, String because, Object[] becauseArgs)
   at RoutingTests.UnitResponseModuleTests.U010_CheckTranslationAsync(Int64 sId, String sheetName, Int32 expected, Int32 excelRowCount) in C:\Users\sogscx\source\repos\Float\Compute\Test\RoutingTests\UnitResponseModuleTests.cs:line 480
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()