mirror of
https://github.com/Smaug123/WoofWare.Whippet
synced 2025-10-07 00:38:39 +00:00
Some checks are pending
.NET / build (Release) (push) Waiting to run
.NET / analyzers (push) Waiting to run
.NET / build (Debug) (push) Waiting to run
.NET / check-dotnet-format (push) Waiting to run
.NET / check-nix-format (push) Waiting to run
.NET / Check links (push) Waiting to run
.NET / Check flake (push) Waiting to run
.NET / nuget-pack (push) Waiting to run
.NET / expected-pack (push) Blocked by required conditions
.NET / check-accurate-generations (push) Waiting to run
.NET / all-required-checks-complete (push) Blocked by required conditions
.NET / nuget-publish (push) Blocked by required conditions
.NET / nuget-publish-fantomas (push) Blocked by required conditions
.NET / nuget-publish-json-plugin (push) Blocked by required conditions
.NET / nuget-publish-json-attrs (push) Blocked by required conditions
.NET / nuget-publish-argparser-plugin (push) Blocked by required conditions
.NET / nuget-publish-argparser-attrs (push) Blocked by required conditions
.NET / nuget-publish-httpclient-plugin (push) Blocked by required conditions
.NET / nuget-publish-httpclient-attrs (push) Blocked by required conditions
.NET / nuget-publish-interfacemock-plugin (push) Blocked by required conditions
37 lines
1.1 KiB
Forth
37 lines
1.1 KiB
Forth
namespace WoofWare.Whippet.Plugin.InterfaceMock.Test
|
|
|
|
open System
|
|
open SomeNamespace
|
|
open NUnit.Framework
|
|
open FsUnitTyped
|
|
|
|
[<TestFixture>]
|
|
module TestMockGeneratorNoAttr =
|
|
|
|
[<Test>]
|
|
let ``Example of use: IPublicType`` () =
|
|
let mock : IPublicTypeNoAttr =
|
|
{ PublicTypeNoAttrMock.Empty with
|
|
Mem1 = fun (s, count) -> List.replicate count s
|
|
}
|
|
:> _
|
|
|
|
let _ =
|
|
Assert.Throws<NotImplementedException> (fun () -> mock.Mem2 "hi" |> ignore<int>)
|
|
|
|
mock.Mem1 ("hi", 3) |> shouldEqual [ "hi" ; "hi" ; "hi" ]
|
|
|
|
[<Test>]
|
|
let ``Example of use: curried args`` () =
|
|
let mock : CurriedNoAttr<_> =
|
|
{ CurriedNoAttrMock.Empty () with
|
|
Mem1 = fun i c -> Array.replicate i c |> String
|
|
Mem2 = fun (i, s) c -> String.concat $"%c{c}" (List.replicate i s)
|
|
Mem3 = fun (i, s) c -> String.concat $"%c{c}" (List.replicate i s)
|
|
}
|
|
:> _
|
|
|
|
mock.Mem1 3 'a' |> shouldEqual "aaa"
|
|
mock.Mem2 (3, "hi") 'a' |> shouldEqual "hiahiahi"
|
|
mock.Mem3 (3, "hi") 'a' |> shouldEqual "hiahiahi"
|