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
internal static void SplitDirectoryFile(string path, out string directory, out string file) | |
{ | |
directory = null; | |
file = null; | |
// assumes a validated full path | |
if (path != null) | |
{ | |
int length = path.Length; | |
int rootLength = GetRootLength(path); |
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
private const string GreaterThanZeroExpectionMessage = "The age should be greater than zero."; | |
private const string SmallerThan123ExpectionMessage = "The age should be smaller than 123."; | |
private const string ShouldBeIntegerExpectionMessage = "The age input should be an integer value between 0 - 122."; | |
[TestCase("-1", 0, ExpectedException = typeof(ArgumentException), ExpectedMessage = GreaterThanZeroExpectionMessage)] | |
[TestCase("0", 0, ExpectedException = typeof(ArgumentException), ExpectedMessage = GreaterThanZeroExpectionMessage)] | |
[TestCase("1", 0)] | |
[TestCase("4", 0)] | |
[TestCase("5", 0)] | |
[TestCase("6", 20)] |
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
private const string GreaterThanZeroExpectionMessage = "The age should be greater than zero."; | |
private const string SmallerThan123ExpectionMessage = "The age should be smaller than 123."; | |
private const string ShouldBeIntegerExpectionMessage = "The age input should be an integer value between 0 - 122."; | |
[TestCase("0", 0, ExpectedException = typeof(ArgumentException), ExpectedMessage = GreaterThanZeroExpectionMessage)] | |
[TestCase("5", 0)] | |
[TestCase("15", 20)] | |
[TestCase("25", 40)] | |
[TestCase("80", 5)] | |
[TestCase("1000", 0, ExpectedException = typeof(ArgumentException), ExpectedMessage = SmallerThan123ExpectionMessage)] |
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
else | |
{ | |
throw new ArgumentException("The age should be smaller than 123."); | |
} |
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
if (age <= 0) | |
{ | |
throw new ArgumentException("The age should be greater than zero."); | |
} |
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
if (!isInteger) | |
{ | |
throw new ArgumentException("The age input should be an integer value between 0 - 122."); | |
} |
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
else if (age >= 65 && age <= 122) | |
{ | |
subscriptionPrice = 5; | |
} |
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
еlse if (age > 18 && age < 65) | |
{ | |
subscriptionPrice = 40; | |
} |
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
else if (age > 5 && age <= 18) | |
{ | |
subscriptionPrice = 20; | |
} |
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
else if (age > 0 && age <= 5) | |
{ | |
subscriptionPrice = 0; | |
} |