public void ctor() { var obj = new DerivedFileReceiverTask(); Assert.Null(obj.Folder); Assert.Equal(SearchOption.AllDirectories, obj.SearchOption); Assert.Equal("*.*", obj.SearchPattern); }
public void op_Run_whenEmptyPatternSpecified() { using (var temp = new TempDirectory()) { using (var obj = new DerivedFileReceiverTask(temp.Info, string.Empty, SearchOption.TopDirectoryOnly)) { obj.Run(); } } }
public void op_Run_whenNoFolderSpecified() { using (var obj = new DerivedFileReceiverTask(null, "*.csv", SearchOption.TopDirectoryOnly)) { // ReSharper disable AccessToDisposedClosure Assert.Throws <InvalidOperationException>(() => obj.Run()); // ReSharper restore AccessToDisposedClosure } }
public void ctor_DirectoryInfo() { using (var temp = new TempDirectory()) { var obj = new DerivedFileReceiverTask(temp.Info); Assert.Equal(temp.Info, obj.Folder); Assert.Equal(SearchOption.AllDirectories, obj.SearchOption); Assert.Equal("*.*", obj.SearchPattern); } }
public void op_Run_whenNoPatternSpecified() { using (var temp = new TempDirectory()) { using (var obj = new DerivedFileReceiverTask(temp.Info, null, SearchOption.TopDirectoryOnly)) { // ReSharper disable AccessToDisposedClosure Assert.Throws <ArgumentNullException>(() => obj.Run()); // ReSharper restore AccessToDisposedClosure } } }
public void op_Run() { using (var temp = new TempDirectory()) { var file = temp.Info.ToFile("example.txt"); file.CreateNew(); using (var obj = new DerivedFileReceiverTask(temp.Info, "*.txt", SearchOption.TopDirectoryOnly)) { obj.Run(); file.Refresh(); Assert.False(file.Exists); } } }