Static methods to separate classes

Sep 16, 2011 at 8:52 AM
Edited Sep 16, 2011 at 9:26 AM

IDateTimeWrap should not contain static methods and properties of DateTime (like Not or Today).

IDateTimeSystem should exist for such purposes.

The same for other classes with static members.

What do you thing?

Sep 16, 2011 at 9:45 AM
Edited Sep 16, 2011 at 9:49 AM


    public interface IProcessSystem
        IProcessWrap Start(string fileName);

    public class ProcessSystem : IProcessSystem
        public IProcessWrap Start(string fileName)
            return new ProcessWrap(Process.Start(fileName));

Sep 16, 2011 at 11:12 AM


    public class FileInfoSystem: IFileInfoSystem
        public IFileInfoWrap GetFileInfo(string fileName)
          return  new FileInfoWrap(fileName);
Sep 26, 2011 at 2:56 PM

It's very important to be able to mock Not and Today.  That's why they cannot be static.

Sep 26, 2011 at 3:01 PM
Edited Sep 26, 2011 at 3:02 PM

I fully agree with need of mocking of Now and Today.

But I think instace of IDateTimeWrap containing static members of DateTime is confusing (the same to other classes).

I am just interesting - may be you see some bad consequences of splitting static and instance members into different wraps?