ume05rw / EzSmb

SMB(Windows shared folder) Clinet Library powered by TalAloni's SmbLibrary, Xamarin & .NET Core Ready.
GNU Lesser General Public License v3.0
53 stars 23 forks source link

No easy way to mock the connection for unit testing. #18

Open dulsi opened 2 years ago

dulsi commented 2 years ago

To implement some unit tests, I've written a wrapper around some of EzSmb. Instead of calling Node.GetNode, I created ISmbHelper and SmbHelper which have a non-static method GetNode. That way I can create a MockSmbHelper that just uses the local filesystem for unit test purposes. Ideally MockSmbHelper would create MockNode derived from Node but the internal constructor doesn't allow that. Have you consider adding some mock classes to allow people to easily unit test? Would you be open to a patch adding that? If so any concerns about the approach I outlined here?