Exemplo n.º 1
0
        public async System.Threading.Tasks.Task GetAllProjectsAsync()
        {
            var projectsFacadeList = await Pivotal.Projects().GetAllAsync();

            Assert.IsNotNull(projectsFacadeList);
            Assert.AreNotEqual(0, projectsFacadeList.Count);
        }
Exemplo n.º 2
0
        public void DeliverAllFinishedStories()
        {
            Story s = CreateNewStory("to  be finished", StoryTypeEnum.Feature, "finish me!");

            Pivotal
            .Projects()
            .Get(Project.Id)
            .Stories()
            .Get(s.Id)
            .Update(story =>
            {
                story.Estimate     = 1;
                story.OwnedBy      = story.RequestedBy;
                story.CurrentState = StoryStateEnum.Finished;
            })
            .Done()
            .Done()
            .DeliverAllFinishedStories()
            .Stories()
            .Get(s.Id)
            .Do(story =>
            {
                Assert.AreEqual(StoryStateEnum.Delivered, story.CurrentState);
            })
            .Delete();
        }
Exemplo n.º 3
0
        public void CreateProject()
        {
            const string projectName = "test project creation";
            int          id          = 0;
            DateTime     startDate   = new DateTime(2011, 03, 01);

            Pivotal
            .Projects()
            .Create()
            .SetName(projectName)
            .SetIterationLength(3)
            .SetStartDateTime(startDate)
            .Save()
            .Do(p =>
            {
                Assert.AreNotEqual(0, p.Id);
                id = p.Id;
                Assert.AreEqual(p.Name, projectName);
            })
            .Done()
            .Get(id)        //reload
            .Do(p =>
            {
                Assert.AreNotEqual(0, p.Id);
                Assert.AreEqual(p.Name, projectName);
                Assert.AreEqual(startDate, p.StartDate);
            })
            .Done()
            .Done()
            .Done();
        }
Exemplo n.º 4
0
 public async System.Threading.Tasks.Task CreateStoryAsync()
 {
     (await
          (await
          Pivotal
          .Projects()
          .GetAsync(Project.Id))
      .Stories()
      .Create()
      .SetName("Im famous")
      .SetType(StoryTypeEnum.Chore)
      .SetDescription("test description")
      .SaveAsync())
     .Do(s =>
     {
         Assert.AreEqual(s.Name, "Im famous");
         Assert.AreEqual(s.Type, StoryTypeEnum.Chore);
         Assert.AreEqual(s.Description, "test description");
         Assert.IsTrue(s.Id > 0);
     })
     .Done()
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 5
0
        public async System.Threading.Tasks.Task UpdateStoryAsync()
        {
            const string DESCRIPTION = "test updated successfully";

            (await
                 (await
                     (await
                         (await
                         Pivotal
                         .Projects()
                         .GetAsync(Project.Id))
                     .Stories()
                     .GetAsync(Story.Id))
                 .UpdateAsync(s =>
            {
                s.Description = DESCRIPTION;
            }))
             .Done()
             .GetAsync(Story.Id))
            .Do((f, s) =>
            {
                Assert.AreEqual(s.Description, DESCRIPTION);
            })
            .Done()
            .Done()
            .Done()
            .Done()
            .Done();
        }
Exemplo n.º 6
0
        public void UpdateStory()
        {
            const string DESCRIPTION = "test updated successfully";

            Pivotal
            .Projects()
            .Get(Project.Id)
            .Stories()
            .Get(Story.Id)
            .Update(s =>
            {
                s.Description = DESCRIPTION;
            })
            .Done()
            .Get(Story.Id)
            .Do((f, s) =>
            {
                Assert.AreEqual(s.Description, DESCRIPTION);
            })
            .Done()
            .Done()
            .Done()
            .Done()
            .Done();
        }
Exemplo n.º 7
0
        public void CanConnectToPivotal()
        {
            var config = new Config();
            var p      = new Pivotal(config.Get <string>("PivotalUserAPIKey"));
            var story  = p.GetUnestimatedStory(0);

            Assert.That(story, Is.Not.Null);
        }
Exemplo n.º 8
0
 private static Project CreateNewProject(string name)
 {
     return(Pivotal
            .Projects()
            .Create()
            .SetName(name)
            .SetIterationLength(3)
            .Save().Item);
 }
Exemplo n.º 9
0
 private static async Task <Project> CreateNewProjectAsync(string name)
 {
     return((await Pivotal
             .Projects()
             .Create()
             .SetName(name)
             .SetIterationLength(3)
             .SaveAsync()).Item);
 }
Exemplo n.º 10
0
 private static async Task <Story> CreateNewStoryAsync(string name, StoryTypeEnum type, string description)
 {
     return((await
                 (await Pivotal.Projects().GetAsync(Project.Id))
             .Stories()
             .Create()
             .SetName(name)
             .SetType(type)
             .SetDescription(description)
             .SaveAsync()).Item);
 }
Exemplo n.º 11
0
 private static Story CreateNewStory(string name, StoryTypeEnum type, string description)
 {
     return(Pivotal
            .Projects()
            .Get(Project.Id)
            .Stories()
            .Create()
            .SetName(name)
            .SetType(type)
            .SetDescription(description)
            .Save().Item);
 }
Exemplo n.º 12
0
        public void CanAssignPointsToAStory()
        {
            const int projectId = 0, storyId = 13115015;
            var       config = new Config();
            var       p      = new Pivotal(config.Get <string>("PivotalUserAPIKey"));

            p.EstimateStory(projectId, storyId, 1);

            var story = p.GetStory(0, storyId);

            Assert.That(story.Estimate, Is.EqualTo(1));
        }
Exemplo n.º 13
0
 public void GetAllMemberships()
 {
     Pivotal
     .Projects()
     .Get(Project.Id)
     .Membership()
     .All(members =>
     {
         Assert.IsNotNull(members);
         Assert.AreEqual(1, members.Count());
         Assert.IsNotNull(members.First().Person);
         Assert.IsNotNull(members.First().Person.Name);
     });
 }
Exemplo n.º 14
0
 public void GetOneStory()
 {
     Pivotal
     .Projects()
     .Get(Project.Id)
     .Stories()
     .Get(Story.Id)
     .Do(s => {
         Assert.AreEqual(Story.Id, s.Id);
         Assert.AreEqual(Story.Name, s.Name);
     })
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 15
0
        public void AddMembership()
        {
            Pivotal
            .Projects()
            .Get(Project.Id)
            .Membership()
            .Add(p =>
            {
                var m            = new Membership();
                m.MembershipRole = MembershipRoleEnum.Member;
                m.Person.Name    = Properties.Settings.Default.NewMemberName;
                m.Person.Email   = Properties.Settings.Default.NewMemberEmail;

                return(m);
            });
        }
Exemplo n.º 16
0
 public async System.Threading.Tasks.Task GetAllMembershipsAsync()
 {
     await
         (await
         Pivotal
         .Projects()
         .GetAsync(Project.Id))
     .Membership()
     .AllAsync(members =>
     {
         Assert.IsNotNull(members);
         Assert.AreEqual(1, members.Count());
         Assert.IsNotNull(members.First().Person);
         Assert.IsNotNull(members.First().Person.Name);
     });
 }
Exemplo n.º 17
0
 public void GetAllStories()
 {
     Pivotal
     .Projects()
     .Get(Project.Id)
     .Stories()
     .All()
     .Do((f, s) =>
     {
         Assert.IsTrue(true);
     })
     .Done()
     .Done()
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 18
0
 public async System.Threading.Tasks.Task GetOneStoryAsync()
 {
     (await
          (await
          Pivotal
          .Projects()
          .GetAsync(Project.Id))
      .Stories()
      .GetAsync(Story.Id))
     .Do(s => {
         Assert.AreEqual(Story.Id, s.Id);
         Assert.AreEqual(Story.Name, s.Name);
     })
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 19
0
 private Story[] GetPivotalStories()
 {
     Cursor = Cursors.WaitCursor;
     IPivotal p = new Pivotal(txtStep_PivotalUsername.Text, txtStep_PiovtalPassword.Text);
     try
     {
         var iterations = p.GetIteration((Project) cboPivotalProjects.SelectedItem,
                                         ((Pivotal.IterationVersion) cboPivotalIteration.SelectedItem));
         return iterations.First().Stories.stories;
     }
     catch (Exception ex)
     {
         //LogError(ex);
     }
     Cursor = Cursors.Arrow;
     return new Story[] {};
 }
Exemplo n.º 20
0
 private static StoryFacade <StoriesProjectFacade> UploadAttachment(string DATA)
 {
     return(Pivotal
            .Projects()
            .Get(Project.Id)
            .Stories()
            .Get(Story.Id)
            .UploadAttachment((s, stream) =>
     {
         using (var writer = new StreamWriter(stream, Encoding.ASCII))
         {
             writer.WriteLine(DATA);
         }
     })
            .Done()
            .Get(Story.Id));
 }
Exemplo n.º 21
0
 public async System.Threading.Tasks.Task GetAllStoriesAsync()
 {
     (await
          (await Pivotal
          .Projects()
          .GetAsync(Project.Id))
      .Stories()
      .AllAsync())
     .Do((f, s) =>
     {
         Assert.IsTrue(true);
     })
     .Done()
     .Done()
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 22
0
        public async System.Threading.Tasks.Task AddMembershipAsync()
        {
            await
                (await
                Pivotal
                .Projects()
                .GetAsync(Project.Id))
            .Membership()
            .Add(p =>
            {
                var m            = new Membership();
                m.MembershipRole = MembershipRoleEnum.Member;
                m.Person.Name    = Properties.Settings.Default.NewMemberName;
                m.Person.Email   = Properties.Settings.Default.NewMemberEmail;

                return(m);
            });
        }
Exemplo n.º 23
0
        public async System.Threading.Tasks.Task EntireTestAsync()
        {
            byte[] someBytes = System.Text.Encoding.ASCII.GetBytes("Hello World"); //Some bytes

            (await
                 (await
                     (await
                         (await
                             (await
                             Pivotal
                             .Projects()
                             .GetAsync(Project.Id)) //ProjectId
                         .Stories()
                         .Create()
                         .SetName("This is my first story")
                         .SetType(StoryTypeEnum.Feature)
                         .SetDescription("i'am happy it's so easy !")
                         .SaveAsync())
                     .AddNoteAsync("this is really amazing"))
                 .UploadAttachment(someBytes, "attachment.txt", "text/plain")
                 .UpdateAsync(story =>
            {
                story.Estimate = 3;
                story.OwnedBy = story.RequestedBy;
                story.CurrentState = StoryStateEnum.Started;
            }))
             .Done()
             .FilterAsync("state:started"))
            .Do(stories =>
            {
                foreach (var s in stories)
                {
                    Console.WriteLine("{0}: {1} ({2})", s.Id, s.Name, s.Type);
                    foreach (var n in s.Notes)
                    {
                        Console.WriteLine("\tNote {0} ({1}): {2}", n.Id, n.Description, n.NoteDate);
                    }
                }
            })
            .Done()
            .Done()
            .Done()
            .Done();
        }
Exemplo n.º 24
0
        public void RemoveMembership()
        {
            AddMembership();

            Pivotal
            .Projects()
            .Get(Project.Id)
            .Membership()
            .Remove(p =>
            {
                return(p.Memberships.Where(m => m.Person.Email == Properties.Settings.Default.NewMemberEmail).First());
            })
            .Done()
            .Membership()
            .All(members =>
            {
                Assert.AreEqual(0, members.Where(m => m.Person.Email == Properties.Settings.Default.NewMemberEmail).Count());
            });
        }
Exemplo n.º 25
0
 public void AddNoteToStory()
 {
     Pivotal
     .Projects()
     .Get(Project.Id)
     .Stories()
     .Get(Story.Id)
     .AddNote("YOUPI")
     .Done()
     .Get(Story.Id)
     .Do(s =>
     {
         Assert.AreEqual(1, s.Notes.Count(n => n.Description == "YOUPI"));
     })
     .Done()
     .Done()
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 26
0
        public void FilterStories()
        {
            var i = 0;

            Pivotal
            .Projects()
            .Get(Project.Id)
            .Stories()
            .Filter("state:unstarted")
            .Do(stories =>
            {
                i++;
            })
            .Done()
            .Done()
            .Done()
            .Done()
            .Done();

            Assert.IsTrue(i > 0);
        }
Exemplo n.º 27
0
        public void DeleteStory()
        {
            Story s = CreateNewStory("to  be deleted", StoryTypeEnum.Feature, "delete me!");


            try
            {
                Pivotal
                .Projects()
                .Get(Project.Id)
                .Stories()
                .Get(s.Id)
                .Delete()
                .Done()
                .Stories()
                .Get(s.Id);
            }
            catch (System.Net.WebException ex)
            {
                Assert.AreEqual(HttpStatusCode.NotFound, ((HttpWebResponse)ex.Response).StatusCode);
            }
        }
Exemplo n.º 28
0
        public async System.Threading.Tasks.Task RemoveMembership()
        {
            await AddMembershipAsync();

            await
                (await
                    (await
                    Pivotal
                    .Projects()
                    .GetAsync(Project.Id))
                .Membership()
                .RemoveAsync(p =>
            {
                return(p.Memberships.Where(m => m.Person.Email == Properties.Settings.Default.NewMemberEmail).First());
            }))
            .Done()
            .Membership()
            .AllAsync(members =>
            {
                Assert.AreEqual(0, members.Where(m => m.Person.Email == Properties.Settings.Default.NewMemberEmail).Count());
            });
        }
Exemplo n.º 29
0
        public async System.Threading.Tasks.Task FilterStoriesAsync()
        {
            var i = 0;

            (await
                 (await
                 Pivotal
                 .Projects()
                 .GetAsync(Project.Id))
             .Stories()
             .FilterAsync("state:unstarted"))
            .Do(stories =>
            {
                i++;
            })
            .Done()
            .Done()
            .Done()
            .Done()
            .Done();

            Assert.IsTrue(i > 0);
        }
Exemplo n.º 30
0
 public void CreateStory()
 {
     Pivotal
     .Projects()
     .Get(Project.Id)
     .Stories()
     .Create()
     .SetName("Im famous")
     .SetType(StoryTypeEnum.Chore)
     .SetDescription("test description")
     .Save()
     .Do(s =>
     {
         Assert.AreEqual(s.Name, "Im famous");
         Assert.AreEqual(s.Type, StoryTypeEnum.Chore);
         Assert.AreEqual(s.Description, "test description");
         Assert.IsTrue(s.Id > 0);
     })
     .Done()
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 31
0
 public async System.Threading.Tasks.Task AddNoteToStoryAsync()
 {
     (await
          (await
              (await
                  (await
                  Pivotal
                  .Projects()
                  .GetAsync(Project.Id))
              .Stories()
              .GetAsync(Story.Id))
          .AddNoteAsync("YOUPI"))
      .Done()
      .GetAsync(Story.Id))
     .Do(s =>
     {
         Assert.AreEqual(1, s.Notes.Count(n => n.Description == "YOUPI"));
     })
     .Done()
     .Done()
     .Done()
     .Done()
     .Done();
 }
Exemplo n.º 32
0
 private bool VerifyLoginToPivotal()
 {
     try
     {
         pivotal = new Pivotal(txtPivotalUsername.Text,
                               txtPivotalPassword.Text);
         return true;
     }
     catch (Exception exception)
     {
         LogError(exception);
         return false;
     }
 }
Exemplo n.º 33
0
 private void PopulatePivotalProjectsCombo()
 {
     IPivotal p = new Pivotal(txtStep_PivotalUsername.Text, txtStep_PiovtalPassword.Text);
     cboPivotalProjects.DataSource = p.GetAllProjects();
     cboPivotalProjects.DisplayMember = "Name";
 }