Today I will refactor the remaining test from the Count group which is counting returned times the BeforeUpdate was triggered. Here is the test I am working to refactor:
I had already started to break the function: “SetFields_ChangeThem_ReturnCollection” into 2 separate functions and here’s what I have so far:
I think this refactoring into 2 functions might have been enough to finish off my refactoring of the test to at least start using them. What I did was refactor the original function so it will use a new function “ChangeFields_ReturnExistingListOfChanges” which will take the FormAuditor as an object. So here is my attempt. I think it might be kind of clunky but here goes:
Ok, so that works and passes the test, HOWEVER, it is very unreadable in my opinion. Since that is the case, I will look at making it more readable tomorrow as there will be other tests of this kind.