Quantcast
Channel: foq Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 29

Created Unassigned: Calls to generic methods support [14]

$
0
0
Repro from Yan Cui: https://gist.github.com/theburningmonk/438ebe15b99ffd635da2

public interface IDynamoDataAccessLayer
{
void Save<T>(T entity, string config = null);
void Save2<T>(T entity);
void Save3(string entity);
}


let dal =
Mock<IDynamoDataAccessLayer>()
.Setup(fun x -> <@ x.Save(any(), any()) @>)
.Calls<_>(fun x -> printfn "%A" x)
.Setup(fun x -> <@ x.Save2(any()) @>)
.Calls<_>(fun x -> printfn "%A" x)
.Setup(fun x -> <@ x.Save3(any()) @>)
.Calls<_>(fun x -> printfn "%A" x)
.Create()

dal.Save(42) // doesn't work
dal.Save2(42) // doesn't work
dal.Save3("42") // works


// tried this (explicit type for Call<int>) as well, same thing
let dal =
Mock<IDynamoDataAccessLayer>()
.Setup(fun x -> <@ x.Save(any(), any()) @>)
.Calls<int>(fun x -> printfn "%d" x)
.Setup(fun x -> <@ x.Save2(any()) @>)
.Calls<int>(fun x -> printfn "%d" x)
.Setup(fun x -> <@ x.Save3(any()) @>)
.Calls<_>(fun x -> printfn "%A" x)
.Create()

dal.Save(42) // doesn't work
dal.Save2(42) // doesn't work
dal.Save3("42") // works

Viewing all articles
Browse latest Browse all 29

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>