Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The only reason you have the parent class is to create instances of your interface, yes?</p> <p>Use <a href="http://code.google.com/p/moq/" rel="nofollow noreferrer">MOQ</a> instead. </p> <p><strong>Edit:</strong> </p> <blockquote> <p><em>Not quite. The ISomeInterfaceTests&lt;T&gt; class is used to test the functionality of the proxies implementing the ISomeInterface&lt;T&gt; interface - it tests the proxies against the objects they are a proxy for (the oracle).</em> – Cornelius </p> </blockquote> <p>Hmm... that sounds like an integration test. Are your oracle objects read from the database somehow, or are you mocking them like you should be? Anyway, I stand by using Moq to get your instances and mocking vs integration testing in general. </p> <p>But it strikes me that your approach for generalization of your tests may be the issue. Perhaps a different approach? Try this on:</p> <pre><code>public static class GenericISomeInterfaceTests { public static void SomePropertyTest&lt;T&gt;(ISomeInterface&lt;T&gt; target, ISomeInterface&lt;T&gt; oracle) { Assert.AreEqual(oracle.SomeProperty, target.SomeProperty); } public static void SomeActionTest&lt;T&gt;(ISomeInterface&lt;T&gt; target, ISomeInterface&lt;T&gt; oracle) { T oracleValue = oracle.SomeAction(); T targetValue = target.SomeAction(); Assert.AreEqual(oracleValue, targetValue); } // More tests } [TestClass()] public class ClassAProxyTests { [TestMethod] public void SomePropertyStringTest() { // set up instances (using MOQ, or whatever) with the string generic type. // Call them target and oracle // then call your generic test methods GenericISomeInterfaceTests.SomePropertyTest&lt;string&gt;(target, oracle); } [TestMethod] public void SomeActionStringTest() { // set up instances (using MOQ, or whatever) with the string generic type. // Call them target and oracle // then call your generic test methods GenericISomeInterfaceTests.SomeActionTest&lt;string&gt;(target, oracle); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload