KaukausInsurgency / ki-dcs

Kaukasus Insurgency
5 stars 2 forks source link

Refactor TCP Server #235

Closed Igneous01 closed 6 years ago

Igneous01 commented 6 years ago

We need to refactor the TCP Server methods SendToDBSingleData, SendToMySQLSingleData, SendToRedisSingleData, etc... methods as there is too much code duplication occurring - this can be solved using Generics

ie. Create single method SendToDB(input) and let the layers above figure out what type they need

We also need to abstract this method by supplying it with a mock DBClient object so that we can put this method under unit testing to confirm the logic works as expected

Refactor KIDB.cs to store the ConfigReader class as a static public member which can be accessed outside. Currently we are duplicating the same config properties in both ConfigReader and KIDB which is not necessary

Because the KIDB is a static class with static methods, we need to be careful in how we will refactor this to be testable, as Static Classes are generally very difficult to test effectively with unit tests

Igneous01 commented 6 years ago

Closing - will be done in kaukasusinsurgency-api project