Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

[TODO] Try to add some unit tests #3188

Open
Ryochan7 opened this issue Dec 5, 2023 · 1 comment
Open

[TODO] Try to add some unit tests #3188

Ryochan7 opened this issue Dec 5, 2023 · 1 comment

Comments

@Ryochan7
Copy link
Owner

Ryochan7 commented Dec 5, 2023

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

@Ryochan7
Copy link
Owner Author

Ryochan7 commented Dec 7, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant