-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IntegrationTests\UpdateVerb #193
base: release/v0.5.0
Are you sure you want to change the base?
Changes from all commits
f112a2e
b27c11a
f9441a4
008d90e
f3ff1fa
81505b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,33 @@ namespace GitDepend.IntegrationTests.Scenarios | |
/// </summary> | ||
public class HelpPageScenario : TestFixtureBase | ||
{ | ||
private string _path; | ||
private string _lib2Dir; | ||
private string _lib1Dir; | ||
|
||
[TestFixtureSetUp] | ||
public void CloneLib2Repo() | ||
{ | ||
_path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | ||
|
||
//Clone Repo | ||
_lib2Dir = Path.Combine(_path, Lib2Name); | ||
_lib1Dir = Path.Combine(_path, Lib1Name); | ||
Clone(Lib2Url, _lib2Dir); | ||
} | ||
|
||
[TearDown] | ||
public void CleanUpLib1Directory() | ||
{ | ||
SafeDeleteDirectory(_lib1Dir); | ||
} | ||
|
||
[TestFixtureTearDown] | ||
public void CleanUpDirectory() | ||
{ | ||
SafeDeleteDirectory(_path); | ||
} | ||
|
||
[Test] | ||
public void HelpVerb_Returns_Success() | ||
{ | ||
|
@@ -30,21 +57,47 @@ public void InvalidVerb_Returns_InvalidCommand() | |
[Test] | ||
public void CloneVerb_ShouldCloneAllRepos() | ||
{ | ||
var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | ||
var lib2Dir = Path.Combine(path, Lib2Name); | ||
var lib1Dir = Path.Combine(path, Lib2Name); | ||
Clone(Lib2Url, lib2Dir); | ||
var info = GitDepend("clone", _lib2Dir); | ||
|
||
var info = GitDepend("clone", lib2Dir); | ||
var lib1Exists = Directory.Exists(_lib1Dir); | ||
var lib2Exists = Directory.Exists(_lib2Dir); | ||
|
||
var lib1Exists = Directory.Exists(lib1Dir); | ||
var lib2Exists = Directory.Exists(lib2Dir); | ||
|
||
SafeDeleteDirectory(path); | ||
Assert.AreEqual(ReturnCode.Success, info.ReturnCode, "Return Code was Wrong"); | ||
Assert.IsTrue(lib1Exists, "Lib1 Doesn't Exists"); | ||
Assert.IsTrue(lib2Exists, "Lib2 Doesn't Exists"); | ||
} | ||
|
||
Assert.AreEqual(ReturnCode.Success, info.ReturnCode); | ||
Assert.IsTrue(lib1Exists); | ||
Assert.IsTrue(lib2Exists); | ||
|
||
[Test] | ||
public void UpdateVerb_CloneReposChangeLib1_ShouldUpdateArtifacts() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is all in the HelpPageScenario, which should focus only on Help page work flows. You should create a new Scenario file for Updating. |
||
{ | ||
//Clone Verb | ||
var cloneVerbInfo = GitDepend("clone", _lib2Dir); | ||
|
||
var lib1Exists = Directory.Exists(_lib1Dir); | ||
var lib2Exists = Directory.Exists(_lib2Dir); | ||
|
||
Assert.AreEqual(ReturnCode.Success, cloneVerbInfo.ReturnCode, $"Return Code was Wrong - Error: {cloneVerbInfo.StandardError}"); | ||
Assert.IsTrue(lib1Exists, "Lib1 Doesn't Exists"); | ||
Assert.IsTrue(lib2Exists, "Lib2 Doesn't Exists"); | ||
|
||
//Change Lib1 | ||
var updated = UpdateFile(_lib1Dir, $"{Lib1Name}\\StringUtils.cs", "TestData\\NewStringUtils.txt"); | ||
|
||
//Update Verb | ||
var updateVerbInfo = GitDepend("update", _lib2Dir); | ||
|
||
//Check For new Artifacts from Lib1 | ||
var lib1ArtifactsExists = File.Exists(Path.Combine(_lib1Dir, "artifacts/NuGet/Debug/Lib1.0.1.0.nupkg")); | ||
|
||
//Clean up | ||
SafeDeleteDirectory(_lib1Dir); | ||
|
||
Assert.IsTrue(updated, "Unable to update file"); | ||
Assert.AreEqual(ReturnCode.Success, updateVerbInfo.ReturnCode, $"Return Code was Wrong - Error: {updateVerbInfo.StandardError}"); | ||
Assert.IsTrue(lib1ArtifactsExists, "Artifacts don't exists"); | ||
} | ||
|
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Lib1 | ||
{ | ||
public class StringUtils | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this indentation change intentional? If this is the change, I would prefer something else. This kind of indentation stuff is a pet peeve. |
||
{ | ||
public static string Trim(string str) | ||
{ | ||
return str.Trim(); | ||
} | ||
|
||
public static string TrimEnd(string str) | ||
{ | ||
return str.TrimEnd(); | ||
} | ||
|
||
public static string TrimStart(string str) | ||
{ | ||
return str.TrimStart(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all in the HelpPageScenario, which should focus only on Help page work flows. You should create a new Scenario file for Cloning.