PropaneDragon / RushHour

Citizens act like real people when deciding what to do based on the time of day. No more school at 3 am!
33 stars 19 forks source link

Started TimeOfDaySliderTests #21

Closed r4j4h closed 8 years ago

r4j4h commented 8 years ago

This was a pleasure to get started with but I quickly hit a wall with a thrown System.Security.SecurityException: ECall methods must be packaged into a system module. apparently because we use UnityEngine underneath and it wants the Unity C++ runtime but we're only in visual studio testing C#.

I tried a few things after reading these sorts of links:

I think I'd like to to rewrite the component for to have less reliance on Unity stuff where possible, perhaps by passing in a dependency that can be Unity or can be a mocked object, a.k.a. constructor dependency injection. Currently I can't get past .Create throwing this error and am having trouble debugging in to see what line is triggering it.

Until then, we can use the component and test it otherwise, so that's what I've done, but I've included the other stuff in the hopes you have some ideas on how to get it going. :)

The currently not used files are RushHourTests/MockClasses/UIHelperBaseStub.cs and RushHourTests/MockClasses/UnityEngineOverrides.cs.

PropaneDragon commented 8 years ago

Thanks. Also yeah, I've tried to abstract as much as I can away from Unity so it can be tested better as I've come across this a few times trying to add tests. I'll get this in soon.