public void WhenHostProvided_IfPortProvided_ShouldReturnHostAndPort() { // Arrange var mock = new WebServerMockGenerator(); // Act var path = SiteExtensions.GetVirtualPath(mock.ServerManager.Sites[0], "http", "myhost"); // Assert Assert.Equal("http://myhost:8080", path); }
public Constructor() { _mock = new WebServerMockGenerator(); _dependencies = new Dependencies { FileSystem = _mock.FileSystem.Object, EnvironmentSystem = _mock.EnvironmentSystem.Object, ProcessRunner = _mock.ProcessRunner.Object, ServerManagerProvider = _mock.ServerManagerProvider.Object }; }
public void WhenHostNotProvided_IfPortNotProvided_ShouldReturnHostFromBindingAndPort80() { // Arrange var mock = new WebServerMockGenerator(); // Act var path = SiteExtensions.GetVirtualPath(mock.ServerManager.Sites[0], "https", ""); // Assert Assert.Equal("https://mylocalhost", path); }
public void WhenUniqueAppName_ShouldJustReturn() { // Arrange var mock = new WebServerMockGenerator(); var uniqueAppName = mock.MockUniqueApplicationName; // Act var appName = mock.ServerManager.Sites[0].GetUniqueApplicaionName(uniqueAppName); // Assert Assert.Equal(uniqueAppName, appName); }
public void WhenAppNameExist_ShouldIncrement() { // Arrange var mock = new WebServerMockGenerator(). MockApplication(); // Act var appName = mock.ServerManager.Sites[0].GetUniqueApplicaionName(mock.MockApplicationName); // Assert Assert.Equal(mock.MockApplicationName.Trim('/') + "_1", appName); }
public SetCustomHeaders() { TestEasyConfig.Instance = new TestEasyConfig((object)null); _mock = new WebServerMockGenerator(); _dependencies = new Dependencies { FileSystem = _mock.FileSystem.Object, EnvironmentSystem = _mock.EnvironmentSystem.Object, ProcessRunner = _mock.ProcessRunner.Object, ServerManagerProvider = _mock.ServerManagerProvider.Object }; }
public void WhenVirtualDirectoryPathExist_ShouldJustCopy() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationDeployVirtualDirectoryPathExistShouldJustCopy(); // Act, Assert ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], @"c:\Temp\MySite", mock.FileSystem.Object); }
public Create() { TestEasyConfig.Instance = new TestEasyConfig((object)null); _mock = new WebServerMockGenerator(); _dependencies = new Dependencies { FileSystem = _mock.FileSystem.Object, EnvironmentSystem = _mock.EnvironmentSystem.Object, ProcessRunner = _mock.ProcessRunner.Object, ServerManagerProvider = _mock.ServerManagerProvider.Object }; }
public void WhenNoBindings_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator(); mock.ServerManager.Sites[0].Bindings.Clear(); // Act var exception = Assert.Throws <Exception>(() => SiteExtensions.GetVirtualPath(mock.ServerManager.Sites[0], "http", "myhost")); // Assert Assert.Equal(string.Format("Binding for protocol 'http' is not defined for the website '{0}'.", mock.ServerManager.Sites[0].Name), exception.Message); }
public void WhenSourceDoesNotExist_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator() .MockApplicationDeploySourceDoesNotExist(); // Act, Assert var exception = Assert.Throws<Exception>(() => ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[0], @"c:\Temp\MySite", mock.FileSystem.Object)); Assert.Equal(@"Failed to deploy files to application, source directory does not exist: 'c:\Temp\MySite'.", exception.Message); }
public void WhenVirtualDirectoryDoesNotExist_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationVirtualDirectoryDoesNotExist(); // Act, Assert var exception = Assert.Throws<Exception>(() => ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], @"c:\Temp\MySite", mock.FileSystem.Object)); Assert.Equal(string.Format(@"Application '{0}' does not have a virtual directory.", mock.MockApplicationName), exception.Message); }
public void WhenDeployingFileContent_ShouldCreateFile() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationDeployFileContentShouldCreateFile(); // Act, Assert ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], mock.MockRelativePath, mock.MockSampleFileContent, mock.FileSystem.Object); }
public void WhenVirtualDirectoryPathExist_IfRelativePathProvided_ShouldCopyToRelative() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationDeployVirtualDirectoryPathExistIfRelativePathProvidedShouldCopyToRelative(); // Act, Assert ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], @"c:\Temp\MySite", mock.FileSystem.Object, @"..\otherfolder"); }
public void WhenVirtualDirectoryDoesNotExist_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationVirtualDirectoryDoesNotExist(); // Act, Assert var exception = Assert.Throws <Exception>(() => ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], @"c:\Temp\MySite", mock.FileSystem.Object)); Assert.Equal(string.Format(@"Application '{0}' does not have a virtual directory.", mock.MockApplicationName), exception.Message); }
public void WhenSourceDoesNotExist_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator() .MockApplicationDeploySourceDoesNotExist(); // Act, Assert var exception = Assert.Throws <Exception>(() => ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[0], @"c:\Temp\MySite", mock.FileSystem.Object)); Assert.Equal(@"Failed to deploy files to application, source directory does not exist: 'c:\Temp\MySite'.", exception.Message); }
public void WhenDeployingListOfFiles_IfListIsEmpty_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationDeployListOfFilesIfListIsEmptyShouldThrow(); // Act, Assert var exception = Assert.Throws <ArgumentNullException>(() => ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], (string[])null, "", mock.FileSystem.Object)); Assert.True(exception.Message.Contains("filePaths")); }
public void WhenDeployingListOfFiles_ShouldCopyExistingFilesToRelativeSubFolder() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationDeployListOfFilesShouldCopyExistingFilesToRelativeSubFolder(); // Act, Assert ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], new [] { @"c:\Temp\MySite\file1.html", @"c:\Temp\MySite\file2.html", @"c:\Temp\MySite\file3.html" }, @"relative", mock.FileSystem.Object); }
public RemoveBinding() { _mock = new WebServerMockGenerator(); }
public SetDefaultApplicationPool() { _mock = new WebServerMockGenerator(); }
public void WhenDeployingListOfFiles_IfListIsEmpty_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator() .MockApplication() .MockApplicationDeployListOfFilesIfListIsEmptyShouldThrow(); // Act, Assert var exception = Assert.Throws<ArgumentNullException>(() => ApplicationExtensions.Deploy( mock.ServerManager.Sites[0].Applications[mock.MockApplicationName], (string[])null, "", mock.FileSystem.Object)); Assert.True(exception.Message.Contains("filePaths")); }
public GetApplicationProperty() { _mock = new WebServerMockGenerator(); }
public RemoveAllApplications() { _mock = new WebServerMockGenerator(); }
public BuildWebApplication() { TestEasyConfig.Instance = new TestEasyConfig((object)null); _mock = new WebServerMockGenerator(); }
public AddApplication() { _mock = new WebServerMockGenerator(); }
public StoreSchema() { _mock = new WebServerMockGenerator(); }
public AddBinding() { _mock = new WebServerMockGenerator(); }
public LoadSchema() { _mock = new WebServerMockGenerator(); }
public void WhenNoBindings_ShouldThrow() { // Arrange var mock = new WebServerMockGenerator(); mock.ServerManager.Sites[0].Bindings.Clear(); // Act var exception = Assert.Throws<Exception>(() => SiteExtensions.GetVirtualPath(mock.ServerManager.Sites[0], "http", "myhost")); // Assert Assert.Equal(string.Format("Binding for protocol 'http' is not defined for the website '{0}'.", mock.ServerManager.Sites[0].Name), exception.Message); }