Esempio n. 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);
            }
Esempio n. 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
     };
 }
Esempio n. 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);
            }
Esempio n. 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
     };
 }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 25
0
 public RemoveBinding()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 26
0
 public SetDefaultApplicationPool()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 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);
            }
Esempio n. 30
0
 public GetApplicationProperty()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 31
0
 public GetApplicationProperty()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 32
0
 public RemoveAllApplications()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 33
0
 public BuildWebApplication()
 {
     TestEasyConfig.Instance = new TestEasyConfig((object)null);
     _mock = new WebServerMockGenerator();
 }
Esempio n. 34
0
 public AddApplication()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 35
0
 public StoreSchema()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 36
0
 public AddBinding()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 37
0
 public RemoveAllApplications()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 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);
            }
Esempio n. 40
0
 public BuildWebApplication()
 {
     TestEasyConfig.Instance = new TestEasyConfig((object)null);
     _mock = new WebServerMockGenerator();
 }
Esempio n. 41
0
 public LoadSchema()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 42
0
 public AddApplication()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 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);
            }            
Esempio n. 44
0
 public StoreSchema()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 45
0
 public SetDefaultApplicationPool()
 {
     _mock = new WebServerMockGenerator();
 }
Esempio n. 46
0
 public AddBinding()
 {
     _mock = new WebServerMockGenerator();
 }