BadScript 2
Loading...
Searching...
No Matches
FSharpOptionHelperTests.cs
Go to the documentation of this file.
1// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
2
3using System.Reflection;
6using Microsoft.FSharp.Core;
7using FluentAssertions;
8using Xunit;
9
11{
13 {
14 [Fact]
16 {
18 .Should().BeTrue();
19 }
20
21 [Fact]
22 public void Get_underlying_type()
23 {
24 FSharpOptionHelper.GetUnderlyingType(TestData.PropertyType).FullName
25 .Should().BeEquivalentTo("System.String");
26 }
27
28 [Fact]
29 public void Create_some()
30 {
31 var expected = FSharpOptionHelper.Some(FSharpOptionHelper.GetUnderlyingType(TestData.PropertyType), "with data");
32
33 expected.Should().BeOfType<FSharpOption<string>>();
34 FSharpOption<string>.get_IsSome((FSharpOption<string>)expected).Should().BeTrue();
35 }
36
37 [Fact]
38 public void Create_none()
39 {
41
42 FSharpOption<string>.get_IsNone((FSharpOption<string>)expected).Should().BeTrue();
43 }
44
45 private PropertyInfo TestData
46 {
47 get { return typeof(Options_With_FSharpOption).GetProperty("FileName", BindingFlags.Public | BindingFlags.Instance); }
48 }
49 }
50}
static object Some(Type type, object value)