Esempio n. 1
0
        public void CodePlexHandlerIgnoresNonCodePlexPayloads(string payloadContent)
        {
            // Arrange
            var httpRequest = new Mock<HttpRequestBase>();
            var handler = new CodePlexHandler();
            JObject payload = JObject.Parse(payloadContent);

            // Act
            DeploymentInfo deploymentInfo;
            DeployAction result = handler.TryParseDeploymentInfo(httpRequest.Object, payload: payload, targetBranch: null, deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(DeployAction.UnknownPayload, result);
        }
Esempio n. 2
0
        public void CodePlexHandlerNoOpsNonTargetBranchPayloads()
        {
            // Arrange
            string payloadContent = @"{ url: ""https://git01.codeplex.com/pranavkmgittest"", branch: ""test"", deployer: ""codeplex"", oldRef: ""3dc5fc28310a7906a9809f81fc5dc68aa681a1f8"", newRef: ""dcda9b7e70157a89423fd7862f2ee193586ca64f"", scmType: ""Git"" }";
            var httpRequest = new Mock<HttpRequestBase>();
            var handler = new CodePlexHandler();
            JObject payload = JObject.Parse(payloadContent);

            // Act
            DeploymentInfo deploymentInfo;
            DeployAction result = handler.TryParseDeploymentInfo(httpRequest.Object, payload: payload, targetBranch: "prod", deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(DeployAction.NoOp, result);
        }
Esempio n. 3
0
        public void CodePlexHandlerParsesGitPayload()
        {
            // Arrange
            string payloadContent = @"{ url: ""https://git01.codeplex.com/pranavkmgittest"", branch: ""master"", deployer: ""codeplex"", oldRef: ""3dc5fc28310a7906a9809f81fc5dc68aa681a1f8"", newRef: ""dcda9b7e70157a89423fd7862f2ee193586ca64f"", scmType: ""Git"" }";
            var httpRequest = new Mock<HttpRequestBase>();
            var handler = new CodePlexHandler();
            JObject payload = JObject.Parse(payloadContent);

            // Act
            DeploymentInfo deploymentInfo;
            DeployAction result = handler.TryParseDeploymentInfo(httpRequest.Object, payload: payload, targetBranch: "master", deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(DeployAction.ProcessDeployment, result);
            Assert.NotNull(deploymentInfo);
            Assert.Equal("CodePlex", deploymentInfo.Deployer);
            Assert.Equal(RepositoryType.Git, deploymentInfo.RepositoryType);
            Assert.Equal("https://git01.codeplex.com/pranavkmgittest", deploymentInfo.RepositoryUrl);
            Assert.Equal("dcda9b7e70157a89423fd7862f2ee193586ca64f", deploymentInfo.TargetChangeset.Id);
        }
Esempio n. 4
0
        public void CodePlexHandlerParsesInitialPayloadThatDoesNotHaveBranchInfo(string payloadContent)
        {
            // Arrange
            var httpRequest = new Mock<HttpRequestBase>();
            var handler = new CodePlexHandler();
            JObject payload = JObject.Parse(payloadContent);

            // Act
            DeploymentInfo deploymentInfo;
            DeployAction result = handler.TryParseDeploymentInfo(httpRequest.Object, payload: payload, targetBranch: "production", deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(DeployAction.ProcessDeployment, result);
        }