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

Commit 3b11bac

Browse files
committed
Merge pull request #72 from okb/create-project
Change content type from application/xml to text/plain when creating projects
2 parents 3d2e6b3 + abf9a9e commit 3b11bac

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/TeamCitySharp/ActionTypes/Projects.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public Project Details(Project project)
4242

4343
public Project Create(string projectName)
4444
{
45-
return _caller.Post<Project>(projectName, HttpContentTypes.ApplicationXml, "/app/rest/projects/", string.Empty);
45+
return _caller.Post<Project>(projectName, HttpContentTypes.TextPlain, "/app/rest/projects/", HttpContentTypes.ApplicationJson);
4646
}
4747

4848
public void Delete(string projectName)

src/Tests/IntegrationTests/SampleProjectUsage.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ public void it_returns_project_details_when_passing_project()
8383
Project projectDetails = _client.Projects.Details(project);
8484

8585
Assert.That(!string.IsNullOrWhiteSpace(projectDetails.Id));
86+
}
87+
88+
89+
[Test]
90+
public void it_returns_project_details_when_creating_project()
91+
{
92+
var client = new TeamCityClient("localhost:81");
93+
client.Connect("admin", "qwerty");
94+
var projectName = Guid.NewGuid().ToString("N");
95+
var project = client.Projects.Create(projectName);
96+
97+
Assert.That(project, Is.Not.Null);
98+
Assert.That(project.Name, Is.EqualTo(projectName));
8699
}
87100
}
88101
}

0 commit comments

Comments
 (0)