Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #72 from okb/create-project
Browse files Browse the repository at this point in the history
Change content type from application/xml to text/plain when creating projects
  • Loading branch information
stack72 committed Apr 25, 2014
2 parents 3d2e6b3 + abf9a9e commit 3b11bac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TeamCitySharp/ActionTypes/Projects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Project Details(Project project)

public Project Create(string projectName)
{
return _caller.Post<Project>(projectName, HttpContentTypes.ApplicationXml, "/app/rest/projects/", string.Empty);
return _caller.Post<Project>(projectName, HttpContentTypes.TextPlain, "/app/rest/projects/", HttpContentTypes.ApplicationJson);
}

public void Delete(string projectName)
Expand Down
13 changes: 13 additions & 0 deletions src/Tests/IntegrationTests/SampleProjectUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ public void it_returns_project_details_when_passing_project()
Project projectDetails = _client.Projects.Details(project);

Assert.That(!string.IsNullOrWhiteSpace(projectDetails.Id));
}


[Test]
public void it_returns_project_details_when_creating_project()
{
var client = new TeamCityClient("localhost:81");
client.Connect("admin", "qwerty");
var projectName = Guid.NewGuid().ToString("N");
var project = client.Projects.Create(projectName);

Assert.That(project, Is.Not.Null);
Assert.That(project.Name, Is.EqualTo(projectName));
}
}
}

0 comments on commit 3b11bac

Please sign in to comment.