You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace Sample.Test
{[TestClass]publicclassSampleUtilTest{[TestMethod]publicvoidSampleUtil_Method1_Method2_Test(){
Smock.Run(context =>{ context.Setup(()=> SampleUtil.Method1( Smocks.Matching.It.IsAny<IEnumerable<int>>())).Returns("Mock: Method1"); context.Setup(()=> SampleUtil.Method2<int>( Smocks.Matching.It.IsAny<IEnumerable<int>>())).Returns("Mock: Method2"); Assert.AreEqual("Mock: Method1", SampleUtil.Method1(newint[]{1,2,3}));// This test is passed. Assert.AreEqual("Mock: Method2", SampleUtil.Method2(newint[]{1,2,3}));// This test is failed. });}}}
next, I prepared SampleUtil into same dll (in test.dll), Method2 test is passed.
namespace Sample.Test
{publicstaticclassSampleUtil{publicstaticstringMethod1(IEnumerable<int>ids){return"Method1";}publicstaticstringMethod2<T>(IEnumerable<T>ids){return"Method2";}}[TestClass]publicclassSampleUtilTest{[TestMethod]publicvoidSampleUtil_Method1_Method2_Test(){
Smock.Run(context =>{ context.Setup(()=> SampleUtil.Method1( Smocks.Matching.It.IsAny<IEnumerable<int>>())).Returns("Mock: Method1"); context.Setup(()=> SampleUtil.Method2<int>( Smocks.Matching.It.IsAny<IEnumerable<int>>())).Returns("Mock: Method2"); Assert.AreEqual("Mock: Method1", SampleUtil.Method1(newint[]{1,2,3}));// This test is passed. Assert.AreEqual("Mock: Method2", SampleUtil.Method2(newint[]{1,2,3}));// This test is passed.});}}}
Can i test generics-on-generics static method between another dlls? If you know anything, please tell me. Thank you.
The text was updated successfully, but these errors were encountered:
balmychan
changed the title
Can i test generics-on-generics static method between another dlls.
Can i test generics-on-generics static method between another dlls?
Mar 30, 2017
I want to test like below static method. but
Method2
test is failed.In app.dll
In test.dll
next, I prepared
SampleUtil
into same dll (in test.dll),Method2
test is passed.Can i test generics-on-generics static method between another dlls? If you know anything, please tell me. Thank you.
The text was updated successfully, but these errors were encountered: