示例#1
0
        public void UpdateEpicWithMinimumDataSucceeds()
        {
            var client = new TargetProcessClient
            {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Epics)
            };

            var originalName = $"Sample Epic From Code - {DateTime.Now}";
            var epic         = new Epic
            {
                Name    = originalName,
                Project = new Project {
                    Id = 194
                }
            };

            var data = client.CreateData <Epic>(epic);

            Assert.NotNull(data);
            Assert.False(data.HttpResponse.IsError);

            var newName = $"Sample Modified Epic From Code - {DateTime.Now}";
            var newEpic = new Epic {
                Id = data.Data.Id, Project = data.Data.Project, Name = newName
            };
            var newData = client.UpdateData <Epic>(newEpic);

            // Verify name changed
            Assert.NotEqual(newData.Data.Name, originalName);
            Assert.Equal(newData.Data.Name, newName);

            // Verify ID did NOT change
            Assert.Equal(data.Data.Id, newData.Data.Id);
        }
示例#2
0
        public void UpdateFeatureWithNameAndProjectIdSucceeds()
        {
            var client = new TargetProcessClient
            {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Features)
            };

            var name    = $"Sample Feature From Code - {DateTime.Now}";
            var feature = new Feature
            {
                Name    = name,
                Project = new Project {
                    Id = 194
                }
            };

            var data = client.CreateData <Feature>(feature);

            Assert.NotNull(data);
            Assert.False(data.HttpResponse.IsError);

            var newName = $"Sample Modified Feature From Code - {DateTime.Now}";

            var newFeature = new Feature {
                Id = data.Data.Id, Name = newName, Project = data.Data.Project
            };
            var newData = client.UpdateData <Feature>(newFeature);

            // Verify name changed
            Assert.NotEqual(newData.Data.Name, name);
            Assert.Equal(newData.Data.Name, newName);

            // Verify ID did NOT change
            Assert.Equal(data.Data.Id, newData.Data.Id);
        }
示例#3
0
        public void UpdateTimeWithDescriptionFieldsSucceeds()
        {
            var client = new TargetProcessClient
            {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Times)
            };

            var description = $"Sample Time Description - {DateTime.Now}";
            //Create a time entry
            var time = new Time {
                Description = description
            };
            var data = client.CreateData <Time>(time);

            Assert.NotNull(data);
            Assert.False(data.HttpResponse.IsError);

            //get the ID
            var id = data.Data.Id;

            Assert.Equal(data.Data.Description, description);

            // Update the time entry
            var newDescription = $"Sample Modified Time Description - {DateTime.Now}";

            var timeModified = new Time {
                Id = id, Description = newDescription
            };
            var newData = client.UpdateData <Time>(timeModified);

            Assert.NotNull(newData);
            Assert.False(newData.HttpResponse.IsError);
            Assert.NotEqual(newData.Data.Description, description);
            Assert.False(newData.HttpResponse.IsError);

            // Verify description changed
            Assert.Equal(newData.Data.Description, newDescription);

            // Verify ID did NOT change
            Assert.Equal(data.Data.Id, newData.Data.Id);
        }
示例#4
0
        public void UpdateUserStoryWithNameAndProjectWithIdMinimumFieldsSucceeds()
        {
            var client = new TargetProcessClient
            {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.UserStories)
            };

            var originalName = $"Sample Create From Code Story - {DateTime.Now}";
            var story        = new UserStory
            {
                Name    = originalName,
                Project = new Project {
                    Id = 194
                }
            };
            var data = client.CreateData <UserStory>(story);

            Assert.NotNull(data);
            Assert.False(data.HttpResponse.IsError);

            var newName = $"Sample Modified User Story From Code - {DateTime.Now}";

            var newStory = new UserStory {
                Id = data.Data.Id, Name = newName, Project = data.Data.Project
            };

            var newData = client.UpdateData <UserStory>(newStory);

            Assert.NotNull(newData);
            Assert.False(newData.HttpResponse.IsError);

            // Verify name changed
            Assert.NotEqual(newData.Data.Name, originalName);
            Assert.Equal(newData.Data.Name, newName);

            // Verify ID did NOT change
            Assert.Equal(data.Data.Id, newData.Data.Id);
        }
示例#5
0
        public void UpdateTaskWithMinimumDataSucceeds()
        {
            var client = new TargetProcessClient
            {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Tasks)
            };

            var originalName = $"Sample Task From Code - {DateTime.Now}";

            var task = new Task
            {
                Name    = originalName,
                Project = new Project {
                    Id = 194
                },
                UserStory = new UserStory {
                    Id = 204
                }
            };

            var data = client.CreateData <Task>(task);

            Assert.NotNull(data);
            Assert.False(data.HttpResponse.IsError);

            var newName = $"Sample Modified Task From Code - {DateTime.Now}";
            var newTask = new Task {
                Id = data.Data.Id, Project = data.Data.Project, UserStory = data.Data.UserStory, Name = newName
            };
            var newData = client.UpdateData <Task>(newTask);

            // Verify name changed
            Assert.NotEqual(newData.Data.Name, originalName);
            Assert.Equal(newData.Data.Name, newName);

            // Verify ID did NOT change
            Assert.Equal(data.Data.Id, newData.Data.Id);
        }
示例#6
0
        public void UpdateProjectWithMinimumFieldsSucceeds()
        {
            var client = new TargetProcessClient
            {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Projects)
            };

            var originalName = $"Sample Project From Code - {DateTime.Now}";
            var project      = new Project {
                Name = originalName
            };
            var data = client.CreateData <Project>(project);

            Assert.NotNull(data);
            Assert.False(data.HttpResponse.IsError);

            var newName = $"Sample Modified Project Name From Code - {DateTime.Now}";

            var projectModified = new Project {
                Id = data.Data.Id, Name = newName
            };

            var newData = client.UpdateData <Project>(projectModified);

            Assert.NotNull(newData);
            Assert.False(newData.HttpResponse.IsError);

            Assert.False(newData.HttpResponse.IsError);

            // Verify name changed
            Assert.NotEqual(newData.Data.Name, originalName);
            Assert.Equal(newData.Data.Name, newName);

            // Verify ID did NOT change
            Assert.Equal(data.Data.Id, newData.Data.Id);
        }