我正在使用VS 2015社区版,并注意到与使用相同字体的VS 2013社区版相比,文本编辑器中的默认字体模糊不清.我在我的机器上都有这两个,可以看到VS 2013渲染字体更加流畅.
有想法该怎么解决这个吗?我在使用Windows 10的Surface pro 4上
我正在创建一个优值函数计算器,对于不熟悉的人来说,它会选择一些属性,并根据这些属性与某些理想化值(优点函数)的接近程度来计算一个值.然后,这使用户能够找到最符合其要求的项目.
这是我想要使用的代码:
public class MeritFunctionLine
{
public Func<CalculationOutput, double> property { get; set; }
public double value { get; set; }
public ComparisonTypes ComparisonType { get; set; }
}
public class MeritFunction
{
public List<MeritFunctionLine> Lines { get; set; }
public double Calculate(CalculationOutput values)
{
double m = 0;
foreach (var item in Lines)
{
m += Math.Abs(values.property - item.value);
}
return m;
}
}
public class CalculationOutput
{
public double property1 { get; set; }
public double property2 { …Run Code Online (Sandbox Code Playgroud) 我有一个名为'Pane'的课程(想想玻璃窗格),它实现了IPane:
type IPane =
abstract PaneNumber : int with get, set
abstract Thickness : float<m> with get, set
abstract ComponentNumber : int with get, set
abstract Spectra : IGlassDataValues with get, set
...
type Pane(paneNumber, componentNumber, spectra, ...) =
let mutable p = paneNumber
let mutable n = componentNumber
let mutable s = spectra
...
interface IPane with
member this.PaneNumber
with get() = p
and set(value) = p <- value
member this.ComponentNumber
with get() = n
and set(value) = n …Run Code Online (Sandbox Code Playgroud) 我的登录页面上有两个表单:
它们被定义为:
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "");
// form controls etc...
}
Run Code Online (Sandbox Code Playgroud)
和
@using (Html.BeginForm("Register", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "");
// form controls etc...
}
Run Code Online (Sandbox Code Playgroud)
当我提交其中一个表单并且存在验证错误时,会出现问题,两个验证摘要都会显示错误.
ValidationSummary方法有各种重载(https://msdn.microsoft.com/en-us/library/system.web.webpages.html.htmlhelper.validationsummary(v=vs.111).aspx),但没有一个他们解决了这个问题.
所需的功能是:
我有以下单元测试:
open System
open System.Collections.Generic
open Microsoft.VisualStudio.TestTools.UnitTesting
[<TestClass>]
type Test_Spectra () =
let standard = new Standard1()
[<TestMethod>]
member x.LightTransmittance () =
let input = Test_Spectra.TestSprectra1
let expected = 0.32728222797751
let actual = standard.LightTransmittance(input)
Assert.AreEqual(expected, actual)
Run Code Online (Sandbox Code Playgroud)
当我运行单元测试时它会失败,但是'expected'和'actual'的值是相等的:

预期和实际分别推断为浮动和双倍,但我认为浮动简单地说是双倍的简写.这有什么解释吗?
编辑 根据@ Gustavo的评论,我已将最后一行更改为:
Assert.AreEqual(expected, actual, 0.000000000000001)
Run Code Online (Sandbox Code Playgroud)
并且测试通过了.