Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a testing technique to verify all properties have been tested
    primarykey
    data
    text
    <p>I have the following situation and any help would be appreciated.</p> <pre><code>public class Poco { public string SomeData { get;set; } public string SomeMoreData { get;set; } } public class Worker { public Poco DoWork() { // do stuff } } </code></pre> <p>TESTING METHOD A.......</p> <pre><code>[Test] public static void TestPocoIsPopulated() { var objUt = new Worker(); var actual = objUt.DoWork(); var expected = new Poco { SomeData = "reusltOne", SomeMoreData = "resultTwo" }; actual.ShouldBeEquivalentTo(expected); } </code></pre> <p>This works fine. However, with larger tests of nested classes, using ShouldBeEquivalentTo() becomes cumbersome, and I'd like to be able to do this as follows...</p> <p>EDIT: Also with Method A you cant do this.... var expected = new Poco { SomeData = [NOT_NULL] , SomeMoreData = "resultTwo" };</p> <p>TESTING METHOD B.......</p> <pre><code>[Test] public static void TestPocoIsPopulated() { var objUt = new Worker(); var actual = objUt.DoWork(); actual.SomeData.Should().Be("resultOne"); actual.SomeMoreData.Should().Be("resultTwo"); } </code></pre> <p>However, if I add a new property to Poco, then Testing Method B does not complain, and the property may not get tested. Using Method A however, the test will fail as ShouldBeEquivalentTo() will note that the new property is null</p> <p>So, my question is, is there a method C as follows.</p> <p>TESTING METHOD C.........</p> <pre><code>[Test] public static void TestPocoIsPopulated() { var objUt = new Worker(); var actual = objUt.DoWork(); actual.SomeData.Should().Be("resultOne"); actual.SomeMoreData.Should().Be("resultTwo"); actual.Should().HaveAllPropertiesBeenTested().EqualTo(true); // &lt;-------- is this possible? } </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.
 

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