public void UsingScriptingFileSystem() { MockRepository mocks = new MockRepository(); Type fsoType = Type.GetTypeFromProgID("Scripting.FileSystemObject"); Scripting.FileSystemObject fso = (Scripting.FileSystemObject)Activator.CreateInstance(fsoType); IMockTest test = mocks.StrictMock(typeof(IMockTest)) as IMockTest; Expect.Call(test.GetFileSystemObject()).Return(fso); mocks.ReplayAll(); Assert.Same(fso, test.GetFileSystemObject()); mocks.VerifyAll(); }
public void UsingScriptingFileSystem() { Type fsoType = Type.GetTypeFromProgID("Scripting.FileSystemObject"); Scripting.FileSystemObject fso = (Scripting.FileSystemObject)Activator.CreateInstance(fsoType); IMockTest test = MockRepository.Mock <IMockTest>(); test.Expect(x => x.GetFileSystemObject()) .Return(fso); Assert.Same(fso, test.GetFileSystemObject()); test.VerifyExpectations(true); }