mirror of
https://github.com/Smaug123/WoofWare.Myriad
synced 2025-10-06 20:48:40 +00:00
Docs
This commit is contained in:
@@ -13,10 +13,13 @@ open WoofWare.Myriad.Plugins
|
|||||||
type internal PublicTypeMock =
|
type internal PublicTypeMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> string list
|
Mem1 : string * int -> string list
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,10 +47,13 @@ open WoofWare.Myriad.Plugins
|
|||||||
type public PublicTypeInternalFalseMock =
|
type public PublicTypeInternalFalseMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> string list
|
Mem1 : string * int -> string list
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,8 +81,10 @@ open WoofWare.Myriad.Plugins
|
|||||||
type internal InternalTypeMock =
|
type internal InternalTypeMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> unit
|
Mem1 : string * int -> unit
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +109,10 @@ open WoofWare.Myriad.Plugins
|
|||||||
type private PrivateTypeMock =
|
type private PrivateTypeMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> unit
|
Mem1 : string * int -> unit
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,8 +137,10 @@ open WoofWare.Myriad.Plugins
|
|||||||
type private PrivateTypeInternalFalseMock =
|
type private PrivateTypeInternalFalseMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> unit
|
Mem1 : string * int -> unit
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +165,7 @@ open WoofWare.Myriad.Plugins
|
|||||||
type internal VeryPublicTypeMock<'a, 'b> =
|
type internal VeryPublicTypeMock<'a, 'b> =
|
||||||
{
|
{
|
||||||
Mem1 : 'a -> 'b
|
Mem1 : 'a -> 'b
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<'a>
|
Mem1_Calls : ResizeArray<'a>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,8 +284,10 @@ type internal TypeWithInterfaceMock =
|
|||||||
/// Implementation of IDisposable.Dispose
|
/// Implementation of IDisposable.Dispose
|
||||||
Dispose : unit -> unit
|
Dispose : unit -> unit
|
||||||
Mem1 : string option -> string[] Async
|
Mem1 : string option -> string[] Async
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string option>
|
Mem1_Calls : ResizeArray<string option>
|
||||||
Mem2 : unit -> string[] Async
|
Mem2 : unit -> string[] Async
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<unit>
|
Mem2_Calls : ResizeArray<unit>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,10 +318,13 @@ type internal TypeWithPropertiesMock =
|
|||||||
/// Implementation of IDisposable.Dispose
|
/// Implementation of IDisposable.Dispose
|
||||||
Dispose : unit -> unit
|
Dispose : unit -> unit
|
||||||
Prop1 : unit -> int
|
Prop1 : unit -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Prop1_Calls : ResizeArray<unit>
|
Prop1_Calls : ResizeArray<unit>
|
||||||
Prop2 : unit -> unit Async
|
Prop2 : unit -> unit Async
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Prop2_Calls : ResizeArray<unit>
|
Prop2_Calls : ResizeArray<unit>
|
||||||
Mem1 : string option -> string[] Async
|
Mem1 : string option -> string[] Async
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string option>
|
Mem1_Calls : ResizeArray<string option>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,10 +12,13 @@ open System
|
|||||||
type internal PublicTypeNoAttrMock =
|
type internal PublicTypeNoAttrMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> string list
|
Mem1 : string * int -> string list
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,10 +45,13 @@ open System
|
|||||||
type public PublicTypeInternalFalseNoAttrMock =
|
type public PublicTypeInternalFalseNoAttrMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> string list
|
Mem1 : string * int -> string list
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
Mem3 : int * option<System.Threading.CancellationToken> -> string
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
Mem3_Calls : ResizeArray<int * System.Threading.CancellationToken>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +78,10 @@ open System
|
|||||||
type internal InternalTypeNoAttrMock =
|
type internal InternalTypeNoAttrMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> unit
|
Mem1 : string * int -> unit
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,8 +105,10 @@ open System
|
|||||||
type private PrivateTypeNoAttrMock =
|
type private PrivateTypeNoAttrMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> unit
|
Mem1 : string * int -> unit
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,8 +132,10 @@ open System
|
|||||||
type private PrivateTypeInternalFalseNoAttrMock =
|
type private PrivateTypeInternalFalseNoAttrMock =
|
||||||
{
|
{
|
||||||
Mem1 : string * int -> unit
|
Mem1 : string * int -> unit
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string * int>
|
Mem1_Calls : ResizeArray<string * int>
|
||||||
Mem2 : string -> int
|
Mem2 : string -> int
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<string>
|
Mem2_Calls : ResizeArray<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +159,7 @@ open System
|
|||||||
type internal VeryPublicTypeNoAttrMock<'a, 'b> =
|
type internal VeryPublicTypeNoAttrMock<'a, 'b> =
|
||||||
{
|
{
|
||||||
Mem1 : 'a -> 'b
|
Mem1 : 'a -> 'b
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<'a>
|
Mem1_Calls : ResizeArray<'a>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,8 +276,10 @@ type internal TypeWithInterfaceNoAttrMock =
|
|||||||
/// Implementation of IDisposable.Dispose
|
/// Implementation of IDisposable.Dispose
|
||||||
Dispose : unit -> unit
|
Dispose : unit -> unit
|
||||||
Mem1 : string option -> string[] Async
|
Mem1 : string option -> string[] Async
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem1_Calls : ResizeArray<string option>
|
Mem1_Calls : ResizeArray<string option>
|
||||||
Mem2 : unit -> string[] Async
|
Mem2 : unit -> string[] Async
|
||||||
|
/// Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it.
|
||||||
Mem2_Calls : ResizeArray<unit>
|
Mem2_Calls : ResizeArray<unit>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,3 +47,24 @@ module TestCapturingMockGenerator =
|
|||||||
mock.Mem1 (Some "hi") |> Async.RunSynchronously |> shouldEqual [| "hi" |]
|
mock.Mem1 (Some "hi") |> Async.RunSynchronously |> shouldEqual [| "hi" |]
|
||||||
|
|
||||||
mock.Prop1 |> shouldEqual 44
|
mock.Prop1 |> shouldEqual 44
|
||||||
|
|
||||||
|
[<Test>]
|
||||||
|
let ``Example of curried use`` () =
|
||||||
|
let mock =
|
||||||
|
{ CurriedMock<string>.Empty () with
|
||||||
|
Mem1 =
|
||||||
|
fun x y ->
|
||||||
|
x |> shouldEqual 3
|
||||||
|
y |> shouldEqual "hello"
|
||||||
|
"it's me"
|
||||||
|
}
|
||||||
|
|
||||||
|
mock.Mem1 3 "hello" |> shouldEqual "it's me"
|
||||||
|
|
||||||
|
lock mock.Mem1_Calls (fun () -> Seq.toList mock.Mem1_Calls)
|
||||||
|
|> List.exactlyOne
|
||||||
|
|> shouldEqual
|
||||||
|
{
|
||||||
|
bar = 3
|
||||||
|
Arg1 = "hello"
|
||||||
|
}
|
||||||
|
@@ -301,6 +301,10 @@ module internal CapturingInterfaceMockGenerator =
|
|||||||
Type = SynType.app "ResizeArray" [ ty ]
|
Type = SynType.app "ResizeArray" [ ty ]
|
||||||
}
|
}
|
||||||
|> SynField.make
|
|> SynField.make
|
||||||
|
|> SynField.withDocString (
|
||||||
|
PreXmlDoc.create
|
||||||
|
"Additions to this ResizeArray are locked on itself. For maximum safety, lock on this field before reading it."
|
||||||
|
)
|
||||||
| CallField.ArgsObject (argsObjectName, _, generics) ->
|
| CallField.ArgsObject (argsObjectName, _, generics) ->
|
||||||
{
|
{
|
||||||
Attrs = []
|
Attrs = []
|
||||||
|
Reference in New Issue
Block a user