Esempio n. 1
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);
        }
Esempio n. 2
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. 3
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);
        }
        public void CodePlexHandlerNoOpsDeleteRequest()
        {
            // Arrange
            string  payloadContent = @"{ url: ""https://git01.codeplex.com/pranavkmgittest"", branch: ""master"", deployer: ""codeplex"", oldRef: ""3dc5fc28310a7906a9809f81fc5dc68aa681a1f8"", newRef: ""0000000000000000000000000000000000000000"", scmType: ""Git"" }";
            var     httpRequest    = new Mock <HttpRequestBase>();
            var     handler        = new CodePlexHandler(Mock.Of <IRepositoryFactory>());
            JObject payload        = JObject.Parse(payloadContent);

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

            // Assert
            Assert.Equal(DeployAction.NoOp, result);
        }
Esempio n. 5
0
        public void CodePlexHandlerParsesMercurialPayload()
        {
            // Arrange
            string  payloadContent = @"{ url: ""https://hg01.codeplex.com/pranavkmmerctest"", branch: ""default"", deployer: ""codeplex"", oldRef: ""3dc5fc28310a7906a9809f81fc5dc68aa681a1f8"", newRef: ""dcda9b7e70157a89423fd7862f2ee193586ca64f"", scmType: ""Mercurial"" }";
            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: "default", deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(DeployAction.ProcessDeployment, result);
            Assert.NotNull(deploymentInfo);
            Assert.Equal("CodePlex", deploymentInfo.Deployer);
            Assert.Equal(RepositoryType.Mercurial, deploymentInfo.RepositoryType);
            Assert.Equal("https://hg01.codeplex.com/pranavkmmerctest", deploymentInfo.RepositoryUrl);
            Assert.Equal("dcda9b7e70157a89423fd7862f2ee193586ca64f", deploymentInfo.TargetChangeset.Id);
        }