public void TestForwarding()
        {
            var tester = new WrapperTest <IFile>(target =>
            {
                var root = new Mock <IDirectory>();
                root.Setup(i => i.File("Test.txt")).Returns(target);
                return(new RelativeFile(() => root.Object, "Test.txt"));
            });

            tester.RegisterTypeCreator(() => new MemoryStream() as Stream);
            tester.AssertAllMethodsForward();
        }
Exemple #2
0
        public void SwapableStorePostSwao()
        {
            var initialStore = CreateBackedStore();
            var tester       = new WrapperTest <ITransactableStore>(i =>
            {
                var swapable = new SwapableStore(initialStore.Object);
                AsyncPump.Run(() => swapable.CopyAndTransferToNewStore(i));
                return(swapable);
            });

            tester.RegisterTypeCreator(() => new MockDirectory("c:\\a") as IDirectory);
            tester.AssertAllMethodsForward();

            initialStore.VerifyGet(i => i.UntransactedRoot, Times.Once);
            initialStore.VerifyNoOtherCalls();
        }
Exemple #3
0
        public void TestRelativeDirectory()
        {
            var tester = new WrapperTest <MVVM.FileSystem.IDirectory>(target =>
            {
                var root = new Mock <IDirectory>();
                root.Setup(i => i.SubDirectory("Test.txt")).Returns(target);
                return(new RelativeDirectory(() => root.Object, "Test.txt"));
            });

            tester.RegisterTypeCreator(() => new MemoryStream() as Stream);
            tester.ExcludeMember(i => i.File(""));
            tester.ExcludeMember(i => i.SubDirectory(""));
            tester.ExcludeMember(i => i.AllFiles());
            tester.ExcludeMember(i => i.AllFiles("*.*"));
            tester.ExcludeMember(i => i.AllSubDirectories());
            tester.AssertAllMethodsForward();
        }