Is this the correct way to use and test a class that makes use of the factory pattern?

人盡茶涼 提交于 2019-12-14 03:42:27
问题 I don't have a lot of experience with the factory pattern and I've come across a scenario where I believe it is necessary but I'm not sure the I've implemented the pattern correctly and I'm concerned about the impact it's had on the readability of my unit tests. I've created a code snippet that

How do you Mock an class for a unit test that has a return type but no input parameters

隐身守侯 提交于 2019-12-13 17:37:06
问题 I have a method in code that returns an OrganisationModel. public virtual OrganisationModel GetCurrentUserOrganisation() { var user = DBEntities.AspNetUsers.Find(_userId); if (user.ActiveOrganisation != null) { var org = user.OrganisationUsers.Where(p => p.organisationId == user