This project is read-only.

Static methods to separate classes

Sep 16, 2011 at 9:52 AM
Edited Sep 16, 2011 at 10: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 10:45 AM
Edited Sep 16, 2011 at 10: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 12:12 PM


    public class FileInfoSystem: IFileInfoSystem
        public IFileInfoWrap GetFileInfo(string fileName)
          return  new FileInfoWrap(fileName);
Sep 26, 2011 at 3: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 4:01 PM
Edited Sep 26, 2011 at 4: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?