forked from mavezeau/TeamCitySharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
116 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,4 +86,4 @@ | |
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<packages> | ||
<package id="NUnit" version="3.0.1" /> | ||
</packages> | ||
</packages> |
107 changes: 54 additions & 53 deletions
107
src/Tests/UnitTests/ActionTypes/ServerInformationTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,64 @@ | ||
namespace TeamCitySharp.ActionTypes | ||
{ | ||
using FakeItEasy; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
using TeamCitySharp.Connection; | ||
using FakeItEasy; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
using TeamCitySharp.Connection; | ||
|
||
[TestFixture] | ||
public class ServerInformationTest | ||
[TestFixture] | ||
public class ServerInformationTest | ||
{ | ||
private ServerInformation testee; | ||
private ITeamCityCaller teamCityCaller; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
private ServerInformation testee; | ||
private ITeamCityCaller teamCityCaller; | ||
this.teamCityCaller = A.Fake<ITeamCityCaller>(); | ||
this.testee = new ServerInformation(this.teamCityCaller); | ||
} | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
this.teamCityCaller = A.Fake<ITeamCityCaller>(); | ||
this.testee = new ServerInformation(this.teamCityCaller); | ||
} | ||
|
||
[TestCase(true, true, true, true)] | ||
[TestCase(false, false, false, false)] | ||
[TestCase(true, false, false, false)] | ||
[TestCase(false, true, false, false)] | ||
[TestCase(false, false, true, false)] | ||
[TestCase(false, false, false, true)] | ||
public void CreatesBackupWithSelectedParts(bool includeBuildLogs, bool includeConfigurations, bool includeDatabase, bool includePersonalChanges) | ||
{ | ||
const string Filename = "Filename"; | ||
var backupOptions = new BackupOptions | ||
{ | ||
Filename = Filename, | ||
IncludeBuildLogs = includeBuildLogs, | ||
IncludeConfigurations = includeConfigurations, | ||
IncludeDatabase = includeDatabase, | ||
IncludePersonalChanges = includePersonalChanges | ||
}; | ||
|
||
this.testee.TriggerServerInstanceBackup(backupOptions); | ||
|
||
A.CallTo(() => this.teamCityCaller.StartBackup(string.Concat( | ||
"/app/rest/server/backup?fileName=", | ||
Filename, | ||
"&includeBuildLogs=" + includeBuildLogs, | ||
"&includeConfigs=" + includeConfigurations, | ||
"&includeDatabase=" + includeDatabase, | ||
"&includePersonalChanges=" + includePersonalChanges))) | ||
.MustHaveHappened(); | ||
} | ||
|
||
[Test] | ||
public void GetsBackupStatus() | ||
[TestCase(true, true, true, true)] | ||
[TestCase(false, false, false, false)] | ||
[TestCase(true, false, false, false)] | ||
[TestCase(false, true, false, false)] | ||
[TestCase(false, false, true, false)] | ||
[TestCase(false, false, false, true)] | ||
public void CreatesBackupWithSelectedParts(bool includeBuildLogs, bool includeConfigurations, bool includeDatabase, | ||
bool includePersonalChanges) | ||
{ | ||
const string Filename = "Filename"; | ||
var backupOptions = new BackupOptions | ||
{ | ||
const string Status = "Idle"; | ||
Filename = Filename, | ||
IncludeBuildLogs = includeBuildLogs, | ||
IncludeConfigurations = includeConfigurations, | ||
IncludeDatabase = includeDatabase, | ||
IncludePersonalChanges = includePersonalChanges | ||
}; | ||
|
||
this.testee.TriggerServerInstanceBackup(backupOptions); | ||
|
||
A.CallTo(() => this.teamCityCaller.StartBackup(string.Concat( | ||
"/app/rest/server/backup?fileName=", | ||
Filename, | ||
"&includeBuildLogs=" + includeBuildLogs, | ||
"&includeConfigs=" + includeConfigurations, | ||
"&includeDatabase=" + includeDatabase, | ||
"&includePersonalChanges=" + includePersonalChanges))) | ||
.MustHaveHappened(); | ||
} | ||
|
||
[Test] | ||
public void GetsBackupStatus() | ||
{ | ||
const string Status = "Idle"; | ||
|
||
A.CallTo(() => this.teamCityCaller.GetRaw("/app/rest/server/backup")).Returns(Status); | ||
A.CallTo(() => this.teamCityCaller.GetRaw("/app/rest/server/backup")).Returns(Status); | ||
|
||
string status = this.testee.GetBackupStatus(); | ||
string status = this.testee.GetBackupStatus(); | ||
|
||
status.Should().Be(Status); | ||
} | ||
status.Should().Be(Status); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,4 +73,4 @@ | |
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<packages> | ||
<package id="FakeItEasy" version="1.25.3" targetFramework="net40" /> | ||
<package id="FluentAssertions" version="2.0.1" targetFramework="net40" /> | ||
<package id="NUnit" version="3.0.1" targetFramework="net40" /> | ||
</packages> | ||
</packages> |