Example #1
0
        public void TriesToCreate()
        {
            // Arrange
            var nodes     = Substitute.For <ICreateClassificationNodes>();
            var processor = new ClassificationNodes("migration-target", nodes);
            var update    = new WorkItemUpdate
            {
                Fields = new Dictionary <string, Value>
                {
                    ["System.IterationPath"] = new Value {
                        NewValue = @"test\Sprint 1"
                    },
                    ["System.AreaPath"] = new Value {
                        NewValue = @"test\my-project"
                    }
                }
            };

            // Act
            processor.Execute(update);

            // Assert
            nodes
            .Received(1)
            .IfNotExists("iterations", "Sprint 1");

            nodes
            .Received(1)
            .IfNotExists("areas", "my-project");
        }
Example #2
0
        public void GetIterations()
        {
            ClassificationNodes cNodes = new ClassificationNodes(_sourceConfig);

            GetNodesResponse.Nodes iterationNodes = cNodes.GetIterations(_sourceConfig.Project);

            string fetchedPBIsJSON = JsonConvert.SerializeObject(iterationNodes, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\Iterations.json", fetchedPBIsJSON);
        }
        public void WorkItemTracking_ClassificationNodes_GetAreas_Success()
        {
            // arrange
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var result = nodes.GetAreas(_configuration.Project, 100);

            Assert.AreEqual("success", result);
        }
        public void WorkItemTracking_ClassificationNodes_CreateArea_Success()
        {
            // arrange
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var result = nodes.CreateArea(_configuration.Project, "", "Foo");

            Assert.AreEqual("success", result);
        }
        public void CL_WorkItemTracking_ClassificationNodes_GetIterations_Success()
        {
            // arrange
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var result = nodes.GetIterations(_configuration.Project, 100);

            //assert
            Assert.IsNotNull(result);
        }
        public void WorkItemTracking_ClassificationNodes_CreateIteration_Success()
        {
            // arrange
            ClassificationNodes nodes = new ClassificationNodes(_configuration);
            string name = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);

            // act
            var result = nodes.CreateIteration(_configuration.Project, name);

            // assert
            Assert.IsNotNull(result);
        }
        public void WorkItemTracking_Nodes_GetIterations_Success()
        {
            // arrange
            ClassificationNodes request = new ClassificationNodes(_configuration);

            // act
            GetNodesResponse.Nodes response = request.GetIterations(_configuration.Project);

            //assert
            Assert.AreEqual(HttpStatusCode.OK, response.HttpStatusCode);

            request = null;
        }
        public void CL_WorkItemTracking_ClassificationNodes_GetArea_Success()
        {
            // arrange
            string name = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var createResult = nodes.CreateArea(_configuration.Project, name);
            var getResult    = nodes.GetArea(_configuration.Project, name);

            //assert
            Assert.IsNotNull(createResult);
            Assert.IsNotNull(getResult);
        }
        public void CL_WorkItemTracking_ClassificationNodes_RenameArea_Success()
        {
            // arrange
            string path = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var createResult = nodes.CreateArea(_configuration.Project, path);
            var renameResult = nodes.RenameArea(_configuration.Project, path, path + "-rename");

            //assert
            Assert.IsNotNull(createResult);
            Assert.IsNotNull(renameResult);
        }
        public void WorkItemTracking_Nodes_UpdateIterationDates_Success()
        {
            // arrange
            ClassificationNodes request    = new ClassificationNodes(_configuration);
            DateTime            startDate  = new DateTime(2016, 11, 29);
            DateTime            finishDate = new DateTime(2016, 12, 17);
            string path = "Iteration Foo";

            // act
            GetNodeResponse.Node response = request.UpdateIterationDates(_configuration.Project, path, startDate, finishDate);

            //assert
            Assert.AreEqual(HttpStatusCode.OK, response.HttpStatusCode);

            request = null;
        }
        public void WorkItemTracking_Nodes_GetIteration_Success()
        {
            // arrange
            string path = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);
            ClassificationNodes request = new ClassificationNodes(_configuration);

            // act
            GetNodeResponse.Node   createResponse = request.CreateIteration(_configuration.Project, path);
            GetNodesResponse.Nodes getResponse    = request.GetIteration(_configuration.Project, path);

            //assert
            Assert.AreEqual(HttpStatusCode.Created, createResponse.HttpStatusCode);
            Assert.AreEqual(HttpStatusCode.OK, getResponse.HttpStatusCode);

            request = null;
        }
        public void WorkItemTracking_ClassificationNodes_GetIteration_Success()
        {
            // arrange
            string path = "Iteration Foo";
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var result = nodes.GetIteration(_configuration.Project, path);

            //assert
            if (result.Contains("VS402371:"))
            {
                Assert.Inconclusive("path '" + path + "' not found");
            }

            Assert.AreEqual("success", result);
        }
        public void WorkItemTracking_Nodes_RenameIteration_Success()
        {
            // arrange
            ClassificationNodes request = new ClassificationNodes(_configuration);
            string path    = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);
            string newName = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 10) + "-Rename";

            // act
            GetNodeResponse.Node responseCreate = request.CreateIteration(_configuration.Project, path);
            GetNodeResponse.Node responseUpdate = request.RenameIteration(_configuration.Project, path, newName);

            //assert
            Assert.AreEqual(HttpStatusCode.Created, responseCreate.HttpStatusCode);
            Assert.AreEqual(HttpStatusCode.OK, responseUpdate.HttpStatusCode);

            request = null;
        }
        public void CL_WorkItemTracking_ClassificationNodes_DeleteArea_Success()
        {
            // arrange
            string pathDelete         = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-delete";
            string pathMaster         = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-master";
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var createDelete = nodes.CreateArea(_configuration.Project, pathDelete);
            var createMaster = nodes.CreateArea(_configuration.Project, pathMaster);

            nodes.DeleteArea(_configuration.Project, pathDelete, createMaster.Id);

            //assert
            Assert.IsNotNull(createDelete);
            Assert.IsNotNull(createMaster);
        }
        public void CL_WorkItemTracking_ClassificationNodes_MoveArea_Success()
        {
            // arrange
            string pathParent         = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-Parent";
            string pathChild          = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-Child";
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var createParentResult = nodes.CreateArea(_configuration.Project, pathParent);
            var createChildResult  = nodes.CreateArea(_configuration.Project, pathChild);
            var moveResult         = nodes.MoveArea(_configuration.Project, pathParent, createChildResult.Id);

            //assert
            Assert.IsNotNull(createParentResult);
            Assert.IsNotNull(createChildResult);
            Assert.IsNotNull(moveResult);
        }
        public void WorkItemTracking_ClassificationNodes_UpdateIterationDates_Success()
        {
            // arrange
            DateTime startDate  = new DateTime(2016, 12, 28);
            DateTime finishDate = new DateTime(2017, 1, 7);
            string   path       = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);

            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var createResult = nodes.CreateIteration(_configuration.Project, path);
            var updateResult = nodes.UpdateIterationDates(_configuration.Project, path, startDate, finishDate);

            //assert
            Assert.IsNotNull(createResult);
            Assert.IsNotNull(updateResult);
        }
        public void WorkItemTracking_ClassificationNodes_UpdateArea_Success()
        {
            // arrange
            string path = "Area Path Test 1A";
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var result = nodes.UpdateArea(_configuration.Project, path, "Area Path Test 1A-Foo");

            //assert
            if (result.Contains("VS402485:"))
            {
                Assert.Inconclusive("path '" + path + "' not found");
            }

            Assert.AreEqual("success", result);
        }
        public void WorkItemTracking_Nodes_UpdateIterationDates_Success()
        {
            // arrange
            ClassificationNodes request    = new ClassificationNodes(_configuration);
            DateTime            startDate  = new DateTime(2016, 11, 29);
            DateTime            finishDate = new DateTime(2016, 12, 17);
            string path = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);

            // act
            GetNodeResponse.Node responseCreate = request.CreateIteration(_configuration.Project, path);
            GetNodeResponse.Node responseUpdate = request.UpdateIterationDates(_configuration.Project, path, startDate, finishDate);

            //assert
            Assert.AreEqual(HttpStatusCode.Created, responseCreate.HttpStatusCode);
            Assert.AreEqual(HttpStatusCode.OK, responseUpdate.HttpStatusCode);

            request = null;
        }
        public void WorkItemTracking_ClassificationNodes_CreateArea_Success()
        {
            // arrange
            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var result = nodes.CreateArea(_configuration.Project, "", "Foo");

            // assert
            if (result.Contains("VS402371:"))
            {
                Assert.Inconclusive("area path already exists");
            }
            else
            {
                Assert.AreEqual("success", result);
            }
        }
        public void WorkItemTracking_Nodes_MoveArea_Success()
        {
            // arrange
            ClassificationNodes request = new ClassificationNodes(_configuration);
            string parent = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-PARENT";
            string child  = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-child";

            // act
            GetNodeResponse.Node responseParent = request.CreateArea(_configuration.Project, parent);
            GetNodeResponse.Node responseChild  = request.CreateArea(_configuration.Project, child);
            GetNodeResponse.Node responseMove   = request.MoveArea(_configuration.Project, parent, responseChild.id);

            //assert
            Assert.AreEqual(HttpStatusCode.Created, responseParent.HttpStatusCode);
            Assert.AreEqual(HttpStatusCode.Created, responseChild.HttpStatusCode);
            Assert.AreEqual(HttpStatusCode.OK, responseMove.HttpStatusCode);

            request = null;
        }
        public void WorkItemTracking_Nodes_DeleteIteration_Success()
        {
            // arrange
            ClassificationNodes request = new ClassificationNodes(_configuration);
            string masterIteration      = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-MASTER";
            string deleteIteration      = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15) + "-delete";

            // act
            GetNodeResponse.Node responseMaster = request.CreateIteration(_configuration.Project, masterIteration);
            GetNodeResponse.Node responseDelete = request.CreateIteration(_configuration.Project, deleteIteration);
            var responseMove = request.DeleteIteration(_configuration.Project, deleteIteration, responseMaster.id.ToString());

            //assert
            Assert.AreEqual(HttpStatusCode.Created, responseMaster.HttpStatusCode);
            Assert.AreEqual(HttpStatusCode.Created, responseDelete.HttpStatusCode);
            Assert.AreEqual(HttpStatusCode.NoContent, responseMove);

            request = null;
        }
        public void WorkItemTracking_Nodes_CreateIteration_Success()
        {
            // arrange
            ClassificationNodes request = new ClassificationNodes(_configuration);
            string path = System.Guid.NewGuid().ToString().ToUpper().Substring(0, 15);

            // act
            GetNodeResponse.Node response = request.CreateIteration(_configuration.Project, path);

            //assert
            if (response.Message.Contains("VS402371: Classification node name " + path))
            {
                Assert.Inconclusive("Iteration '" + path + "' already exists");
            }
            else
            {
                Assert.AreEqual(HttpStatusCode.Created, response.HttpStatusCode);
            }
            request = null;
        }
        public void WorkItemTracking_Nodes_CreateArea_Success()
        {
            // arrange
            ClassificationNodes request = new ClassificationNodes(_configuration);
            string path = "Area Foo";

            // act
            GetNodeResponse.Node response = request.CreateArea(_configuration.Project, path);

            //assert
            if (response.Message.Contains("VS402371:"))
            {
                Assert.Inconclusive("Area path '" + path + "' already exists");
            }
            else
            {
                Assert.AreEqual(HttpStatusCode.Created, response.HttpStatusCode);
            }
            request = null;
        }
        public void WorkItemTracking_ClassificationNodes_UpdateIterationDates_Success()
        {
            // arrange
            DateTime startDate  = new DateTime(2016, 12, 28);
            DateTime finishDate = new DateTime(2017, 1, 7);
            string   path       = "Iteration Foo";

            ClassificationNodes nodes = new ClassificationNodes(_configuration);

            // act
            var result = nodes.UpdateIterationDates(_configuration.Project, path, startDate, finishDate);

            //assert
            if (result.Contains("VS402485:"))
            {
                Assert.Inconclusive("name '" + path + "' not found");
            }

            Assert.AreEqual("success", result);
        }
        public void WorkItemTracking_ClassificationNodes_CreateIteration_Success()
        {
            // arrange
            ClassificationNodes nodes = new ClassificationNodes(_configuration);
            string startDate          = "11/28/2016";
            string finishDate         = "12/16/2016";
            string path = "Iteration Foo";

            // act
            var result = nodes.CreateIteration(_configuration.Project, path, startDate, finishDate);

            // assert
            if (result.Contains("VS402371:"))
            {
                Assert.Inconclusive("Iteration '" + path + "' already exists");
            }
            else
            {
                Assert.AreEqual("success", result);
            }
        }
        public void WorkItemTracking_Nodes_CreateIteration_Success()
        {
            // arrange
            ClassificationNodes request    = new ClassificationNodes(_configuration);
            DateTime            startDate  = new DateTime(2016, 11, 28);
            DateTime            finishDate = new DateTime(2016, 12, 16);
            string path = "Iteration Foo";

            // act
            GetNodeResponse.Node response = request.CreateIteration(_configuration.Project, path, startDate, finishDate);

            //assert
            if (response.Message.Contains("VS402371: Classification node name " + path))
            {
                Assert.Inconclusive("Iteration '" + path + "' already exists");
            }
            else
            {
                Assert.AreEqual(HttpStatusCode.Created, response.HttpStatusCode);
            }
            request = null;
        }
Example #27
0
        public void IterationPath()
        {
            // Arrange
            var processor = new ClassificationNodes("migration-target", Substitute.For <ICreateClassificationNodes>());
            var update    = new WorkItemUpdate
            {
                Fields = new Dictionary <string, Value>
                {
                    ["System.IterationPath"] = new Value {
                        NewValue = @"test\Sprint 1"
                    }
                }
            };

            // Act
            processor.Execute(update);

            // Assert
            update
            .Fields["System.IterationPath"]
            .NewValue.Should()
            .Be(@"migration-target\Sprint 1");
        }