module FruityFoundation.Tests.FsBase open System.Collections.Generic open FruityFoundation.Base.Structures open NUnit.Framework open FsUnit open FruityFoundation.FsBase [] let ``Array.toReadOnlyCollection casts an array to a read only collection`` () = // Arrange let input = [|1; 2; 3|] // Act let result = input |> Array.toReadOnlyCollection // Assert result |> should be instanceOfType> [] let ``Option.toMaybe returns an empty Maybe for None`` () = // Arrange let input : string option = None // Act let result = input |> Option.toMaybe // Assert Assert.That(result, Is.InstanceOf()) result |> should be instanceOfType result.HasValue |> should equal false [] let ``Option.toMaybe returns Maybe for Some`` () = // Arrange let input : string option = Some "banana" // Act let result = input |> Option.toMaybe // Assert result |> should be instanceOfType result.HasValue |> should equal true result.Value |> should equal "banana" [] let ``ValueOption.toMaybe returns an empty Maybe for None`` () = // Arrange let input : string ValueOption = ValueNone // Act let result = input |> ValueOption.toMaybe // Assert Assert.That(result, Is.InstanceOf()) result |> should be instanceOfType result.HasValue |> should equal false [] let ``ValueOption.toMaybe returns Maybe for Some`` () = // Arrange let input : string ValueOption = ValueSome "banana" // Act let result = input |> ValueOption.toMaybe // Assert result |> should be instanceOfType result.HasValue |> should equal true result.Value |> should equal "banana"