Beispiel #1
0
        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();
        }
Beispiel #2
0
        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);
        }