Ryochan7/DS4Windows

[TODO] Try to add some unit tests

Ryochan7 opened this issue · 1 comments

Been curious about how to write unit tests in C# for a while. I finally looked into it and it looks like there is no negative repercussion to including a test project in the DS4Windows solution. So far, I have written some simple test methods that test the MacroParser class. It would be better to add some more tests especially ones that would test parsing profiles.

It looks like I should have looked into using MSTest sooner.

Related issue
Ryochan7/DS4MapperTest#8

Writing some small mock unit tests has unintentionally revealed a fairly substantial bug in the ProfileMigration class. Ever since DS4Windows 3.2, the ProfileMigration class has been broken as the wrong method was being used to attempt to extract the final XML. It would only return an empty string instead; I think I checked this before but whatever.

The profile XML spec has not really been updated since DS4Windows 2.1.15 according to my notes so this type of bug would likely only affect people trying to use a profile from the Jays2Kings build. That is what the test was attempting to perform. The Log would show a profile load failed message if that error would have occurred.

40b9eba