예제 #1
0
        public void FileCopy_SingleFile_Succeeds()
        {
            // arrange
            using (var harness = new FileSystemHarness().WithSampleFile())
            {
                var fci         = new FileCopyInstruction(harness.SampleFile, harness.TargetFolder, false);
                var targetActor = Sys.ActorOf(Props.Create(() => new FileCopyActor(harness.FileSystem)));

                // act
                targetActor.Tell(new FileCopyMessage("0", fci));

                // assert
                ExpectMsg <FileCopySuccessMessage>(new TimeSpan(0, 0, 30));
                Assert.True(harness.TargetFolderSnap.ListDifferences());
                Assert.True(harness.TargetFolderSnap.IsNewFile(harness.TargetFile));
            }
        }
예제 #2
0
        public void FileCopy_SingleFile_DoNotOverwrite_ExistingFile_Fails()
        {
            // arrange
            using (var harness = new FileSystemHarness().WithTargetFile().Waitabit().WithSampleFile())
            {
                var fci         = new FileCopyInstruction(harness.SampleFile, harness.TargetFolder, false);
                var targetActor = Sys.ActorOf(Props.Create(() => new FileCopyActor(harness.FileSystem)));

                // act
                targetActor.Tell(new FileCopyMessage("0", fci));

                // assert
                ExpectMsg <FileCopyFailMessage>(new TimeSpan(0, 0, 30));
                Assert.True(harness.TargetFolderSnap.NoListDifferences());
                Assert.False(harness.TargetFolderSnap.IsNewlyListedFile(harness.TargetFile));
                Assert.False(harness.TargetFolderSnap.IsRecentlyModified(harness.TargetFile));
            }
        }