I would love some feedback on this!

Hello Everyone. I'm a student, currently working for a firm that sells Virtual machines, webhosting and stuff like that. And due to reasons, that are, way to long to get into, I've recently taken up C#.

To this, I'm currently (as a part of a bigger system) building a API wrapper for Whmcs However, since my career redirection towards programming instead of system administration, I've come to realize that, having someone to look over ones code, especially during the learning process is quite valuable. (i took to programming back in December). Sadly there are no one i can turn to within the company for help with this sort of thing, which for the most part has been alright. Personally i think I've been doing quite well. Sadly i can't show all my work, as a lot of it, has company info in it.

Which is one of the reasons why i decided to make the Whmcs.Net a sideproject. Also because i thought i might eventually share this with everyone, as i couldn't find any comprehensive wrappers written for .Net.

I started this project up a few weeks back, sadly i haven't been able to do much, since i still work full time as a System administrator, and most programming happens at home.

But for what I've got, Id love some feedback.


Question:

When you unit test something, like this. Where you have x json being turned into y classes, during unit testing, would it make sense to do something like this:

If for example you have myclass.Name and myclass.Surname would it make sense to check every property? like so:

Assert.AreEqual("John", myclass.Name) Assert.AreEqual("Doe", myclass.Surname) 

Now considering that the model in the whmcs.net has… well, alot of properties, checking each one, leads to crazy amounts of Asserts. I originally did this, but after filling out my entire screen worth of asserts, i boiled it down a bit.


A few notes:

  • Unit testing, has (sadly) eluded me for quite some time, and so this is my first real project, using unit testing.
  • The project is not done yet, as is quite obvious. As such the .Example was/is used for testing.
  • The company i work for has a Gitlab server running, which is why the Github link only has the initial upload of the project.
  • This is also the first time i work with anything related to Json.

Any feedback is appreciated. While i feel I've gotten a good handle on C# and .Net as a whole, i will definitely take any advice under serious consideration.

by Slackerony via /r/csharp

Leave a Reply