Last active
January 21, 2020 21:53
-
-
Save Basti3n/2d46dea76c2b5d62df105f29679ff137 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
namespace Extra | |
{ | |
public static class Print | |
{ | |
public static string sentence{ get; set; } | |
public static void Talk() => Console.WriteLine(sentence); | |
} | |
public static class Dated | |
{ | |
public static DateTime actual {set; get;} = DateTime.Now; | |
} | |
public static class Houred | |
{ | |
public static int actual_hour {set; get;} = Dated.actual.Hour; | |
} | |
public static class Hello | |
{ | |
public static void Talk(string text = "world") | |
{ | |
Print.sentence = "Good "; | |
if(Houred.actual_hour >= 12 && Houred.actual_hour <=20 ) | |
{ | |
Print.sentence+="afternoon "; | |
} | |
else if((Houred.actual_hour >= 20 && Houred.actual_hour <=23) ||(Houred.actual_hour >= 0 && Houred.actual_hour < 6 )) | |
{ | |
Print.sentence+="night "; | |
}else if(Houred.actual_hour < 12) | |
{ | |
Print.sentence+="morning "; | |
} | |
Print.sentence+=text; | |
Print.Talk(); | |
} | |
} | |
} |
This file contains hidden or 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
using System; | |
using Extra; | |
namespace App | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Hello.Talk("paul"); | |
} | |
} | |
} |
This file contains hidden or 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
using System; | |
using Xunit; | |
using NFluent; | |
using Extra; | |
namespace Tests | |
{ | |
public class UnitTest1 | |
{ | |
[Theory] | |
[InlineData("Paul")] | |
[InlineData("Rimbo")] | |
[InlineData("Tibo Inshape")] | |
public void should_return_GoodAfternoonValue_when_value(string value) | |
{ | |
Houred.actual_hour = 13; | |
Hello.Talk(value); | |
Check.That(Print.sentence).IsEqualTo("Good afternoon "+value); | |
} | |
[Theory] | |
[InlineData("Jean")] | |
[InlineData("Arthur")] | |
[InlineData("Aypierre")] | |
public void should_return_GoodMorningValue_when_value(string value) | |
{ | |
Houred.actual_hour = 10; | |
Hello.Talk(value); | |
Check.That(Print.sentence).IsEqualTo("Good morning "+value); | |
} | |
[Theory] | |
[InlineData("Kevin")] | |
[InlineData("Ronald")] | |
[InlineData("Sylvio")] | |
public void should_return_GoodNightValue_when_value(string value) | |
{ | |
Houred.actual_hour = 2; | |
Hello.Talk(value); | |
Check.That(Print.sentence).IsEqualTo("Good night "+value); | |
} | |
[Theory] | |
[InlineData] | |
public void should_return_GoodNightWorld_when_value_not_set() | |
{ | |
Houred.actual_hour = 2; | |
Hello.Talk(); | |
Check.That(Print.sentence).IsEqualTo("Good night world"); | |
} | |
} | |
} | |
v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment