Weird No behavior in provider types

have type providers with three properties: "a", "b" and "c" of type "string", "string option" and "int option" respectively.

When I have an instance with "", None, and Some 1 in these properties, this fails:

(row1.a, row1.b, row1.c) |> should equal ("", None, Some 1)

But it all works great:

row1.a |> should equal ""

row1.b |> should equal None

row1.c |> should equal (Some 1)

("", None, Some 1) |> should equal ("", None, Some 1)

How is this possible? What can make None in b different from any other No? After compilation, None is just null, can two NULL values ​​differ in .Net?

Tuples have structural equality, like most F # types, so it should work. I get a NUnit.Framework.AssertionException message with the message:

Expected: <(, , Some(1))>
But was:  <(, , Some(1))>

NUnit just calls .Equals, so where the problem is.

This also fails:

(row1.a, row1.b, row1.c).Equals(("", None, Some 1)) |> should equal true

row1 System.Tuple<string,Microsoft.FSharp.Core.FSharpOption<string>,Microsoft.FSharp.Core.FSharpOption<int>>, :

row1 |> should equal ("", None, Some 1)

, None.

, .

+3
1

, :

FsUnit DSL. DSL, , .

, , True, False .., ( formula<fol>.True, formula<fol>.False ..), obj.

FsUnit, . , Jack P. pull - , FsUnit . , FsUnit.

+5

Source: https://habr.com/ru/post/1542887/


All Articles