public void DoGetFilesAsPerTypeOperation_ExecuteOperation_WithUnknownPath_ExpectException() { //---------------------------Arrange--------------------------- var mockActivityIOPath = new Mock <IActivityIOPath>(); mockActivityIOPath.Setup(o => o.Path).Returns("testPath"); //---------------------------Act------------------------------- var doGetFilesAsPerTypeOperation = new DoGetFilesAsPerTypeOperation(mockActivityIOPath.Object, Interfaces.Enums.ReadTypes.Files); //---------------------------Assert---------------------------- Assert.ThrowsException <Exception>(() => doGetFilesAsPerTypeOperation.ExecuteOperation()); }
public void DoGetFilesAsPerTypeOperation_ExecuteOperation_ImpersonatedUser_IsNull_AreEqual_ExpectException() { //---------------------------Arrange--------------------------- var mockActivityIOPath = new Mock <IActivityIOPath>(); var mockDev2LogonProvider = new Mock <IDev2LogonProvider>(); var mockFile = new Mock <IFile>(); var mockDirectory = new Mock <IDirectory>(); const string serverLogFile = @"C:\ProgramData\Warewolf\Server Log\wareWolf-Server.log"; mockActivityIOPath.Setup(o => o.Path).Returns(serverLogFile); //---------------------------Act------------------------------- var doGetFilesAsPerTypeOperation = new DoGetFilesAsPerTypeOperation(mockActivityIOPath.Object, Interfaces.Enums.ReadTypes.Files, mockDev2LogonProvider.Object, mockFile.Object, mockDirectory.Object, (agr1, arg2) => null) { }; //---------------------------Assert---------------------------- mockActivityIOPath.VerifyAll(); Assert.ThrowsException <Exception>(() => doGetFilesAsPerTypeOperation.ExecuteOperation()); }
public void DoGetFilesAsPerTypeOperation_ExecuteOperation_ImpersonatedUser_IsNotNull_IsStarWildCard_True_AreEqual_ExpectTrue() { //---------------------------Arrange--------------------------- var mockActivityIOPath = new Mock <IActivityIOPath>(); var mockDev2LogonProvider = new Mock <IDev2LogonProvider>(); var mockFile = new Mock <IFile>(); var mockDirectory = new Mock <IDirectory>(); var mockWindowsImpersonationContext = new Mock <IWindowsImpersonationContext>(); const string serverLogFile = @"C:\ProgramData\Warewolf\Server Log\wareWolf-Server.*"; mockActivityIOPath.Setup(o => o.Path).Returns(serverLogFile); //---------------------------Act------------------------------- var doGetFilesAsPerTypeOperation = new DoGetFilesAsPerTypeOperation(mockActivityIOPath.Object, Interfaces.Enums.ReadTypes.Files, mockDev2LogonProvider.Object, mockFile.Object, mockDirectory.Object, (agr1, arg2) => mockWindowsImpersonationContext.Object) { }; var list = doGetFilesAsPerTypeOperation.ExecuteOperationWithAuth(); //---------------------------Assert---------------------------- mockActivityIOPath.VerifyAll(); Assert.AreEqual(0, list.Count); }
public void DoGetFilesAsPerTypeOperation_ExecuteOperation_DirectoryExists_True_AreEqual_ExpectTrue() { //---------------------------Arrange--------------------------- var mockActivityIOPath = new Mock <IActivityIOPath>(); var mockDev2LogonProvider = new Mock <IDev2LogonProvider>(); var mockFile = new Mock <IFile>(); var mockDirectory = new Mock <IDirectory>(); const string serverLogFile = @"C:\ProgramData\Warewolf\Server Log\wareWolf-Server.log"; mockDirectory.Setup(o => o.Exists(It.IsAny <string>())).Returns(true); mockActivityIOPath.Setup(o => o.Path).Returns(serverLogFile); //---------------------------Act------------------------------- var doGetFilesAsPerTypeOperation = new DoGetFilesAsPerTypeOperation(mockActivityIOPath.Object, Interfaces.Enums.ReadTypes.Files, mockDev2LogonProvider.Object, mockFile.Object, mockDirectory.Object, (agr1, arg2) => null) { }; var list = doGetFilesAsPerTypeOperation.ExecuteOperation(); //---------------------------Assert---------------------------- mockDirectory.VerifyAll(); mockActivityIOPath.VerifyAll(); Assert.AreEqual(0, list.Count); }