3 ms·
A unit of work is not necessarily a class, but rather its methods. The linked article states that > A unit of work is a use case in the system that startes wit
by jmkjaer 4y ago
A unit of work is not necessarily a class, but rather its methods. The linked article states that
> A unit of work is a use case in the system that startes with a public method and ends up with one of three types of results (...)
I use the same naming as well, and I really like it.
- twodave 4y agoIt took me a few seconds to parse what UnitOfWork meant in this context because that’s also a pattern for carrying e.g. database transactions through to different dependencies. E.g. in C#: using var uow = UnitOfWorkContainer.Begin(); await SomeDep.Save(foo); // internally uses the uow's transaction await SomeOtherDep.Save(foo2); uow.Complete();
- jdkoeck 4y agoYup, that’s what a unit of work is to me too. It’s a well-known design pattern, so overloading that term for testing seems ill-advised.