예제 #1
0
            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);
            }
예제 #2
0
 public Constructor()
 {
     _mock         = new WebServerMockGenerator();
     _dependencies = new Dependencies
     {
         FileSystem            = _mock.FileSystem.Object,
         EnvironmentSystem     = _mock.EnvironmentSystem.Object,
         ProcessRunner         = _mock.ProcessRunner.Object,
         ServerManagerProvider = _mock.ServerManagerProvider.Object
     };
 }
예제 #3
0
            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);
            }
예제 #4
0
            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
     };
 }
예제 #6
0
            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);
            }
예제 #7
0
            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);
            }
예제 #8
0
            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);
            }
예제 #9
0
            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);
            }
예제 #10
0
            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);
            }
예제 #11
0
 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);
            }
예제 #13
0
            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 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);
            }
예제 #15
0
            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 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 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);
            }
예제 #25
0
 public RemoveBinding()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #26
0
 public SetDefaultApplicationPool()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #27
0
 public RemoveBinding()
 {
     _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 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);
            }
예제 #30
0
 public GetApplicationProperty()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #31
0
 public GetApplicationProperty()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #32
0
 public RemoveAllApplications()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #33
0
 public BuildWebApplication()
 {
     TestEasyConfig.Instance = new TestEasyConfig((object)null);
     _mock = new WebServerMockGenerator();
 }
예제 #34
0
 public AddApplication()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #35
0
 public StoreSchema()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #36
0
 public AddBinding()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #37
0
 public RemoveAllApplications()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #38
0
 public LoadSchema()
 {
     _mock = new WebServerMockGenerator();
 }
            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);
            }
예제 #40
0
 public BuildWebApplication()
 {
     TestEasyConfig.Instance = new TestEasyConfig((object)null);
     _mock = new WebServerMockGenerator();
 }
예제 #41
0
 public LoadSchema()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #42
0
 public AddApplication()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #43
0
            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);
            }            
예제 #44
0
 public StoreSchema()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #45
0
 public SetDefaultApplicationPool()
 {
     _mock = new WebServerMockGenerator();
 }
예제 #46
0
 public AddBinding()
 {
     _mock = new WebServerMockGenerator();
 }