I have the following unit test:
string MtrlCode = \"0\";
Assessment target = new Assessment(MtrlCode);
List EdgeCaseSymbolCodes = new List<
If Assert.Equals
uses the default comparer(no idea if it does) then this test will fail since List
uses referential equality by default.
If both lists have the same ordering you can use the linq extensionmethod Enumerable.SequenceEqual to test for element wise equality.
If you want to consider lists with the same elements equal even with different ordering you could use a.Intersect(b).Count()==a.Unit(b).Count()
since there is no SetEqual
extension method in Linq.
And even if it compared by value why do you expect a list containing 3 elements to be equal to a list containing 6 elements?
As a sidenote: Your naming conventions differ from the .net conventions. Usually local variable names start with lower case letters.
And I find the line target.HazardSymbols = EdgeCaseSymbolCodes;
very strange. Does that mean you have a property of type List
with a public setter? I'd rather avoid those since that can lead to different objects using the same instance of a List which can have strange effects if they modify the list they own.