public void Greet_ReturnsHelloName(string name, string expectedMessage) { // Act var result = sut.Greet(name, new DateTime(2020, 01, 01, 15, 30, 0)); // Assert Assert.AreEqual(expectedMessage, result); }
public static void Main() { Greeter greeter = new Greeter("Hello "); greeter.Greet("Rune"); greeter.Greet("Rune", true); Console.Read(); }
public void Greet_logs() { var testLogger = new TestLogger(); var greeter = new Greeter(new TestTimeRetrievalService(new TimeSpan(13, 0, 0)), testLogger); greeter.Greet("cman"); greeter.Greet("cman"); CollectionAssert.AreEqual(new List <string> { "Greeting has been called", "Greeting has been called" }, testLogger.Messages); }
public void GreetInCorrectFormatAndTimeWhenThereIsOnlyOneName() { var names = new List <string> { "Kathleen" }; var time = DateTime.Now.ToString("hh:mmtt").ToLower(); var date = DateTime.Now.Day + " " + DateTime.Now.ToString("MMMM") + " " + DateTime.Now.Year; var expectedGreeting = "Hi Kathleen - the time on the server is " + time + " on " + date; var actualGreeting = Greeter.Greet(names, DateTime.Now); Assert.Equal(expectedGreeting, actualGreeting); }
public void GivenAName_WhenGreeted_ThenSaluationContainsName() { var greeter = new Greeter(); var greeting = greeter.Greet("Bob"); Assert.Equal("Hello Bob", greeting); }
public void TestGreet() { const string testName = "Tobi"; Greeter greeter = new Greeter(); Assert.That(greeter.Greet(testName).Contains(testName)); }
public void CanGreet() { var greeter = new Greeter(); string greet = greeter.Greet(); Assert.AreEqual("Hello World", greet); }
public void ShouldReturnGreetString() { var greeter = new Greeter(); var greetingString = greeter.Greet("Anon"); Assert.Equal("Hello, Anon", greetingString); }
static void Main(string[] args) { // Whole numbers int lesson = 1; // Floating point numbers float height = (float)1.5500000000011111111111222222201; double height2 = 1.55; // Highest precision numbers. // Always for money, scientific calculations decimal balance = 600005000.000001101011654978m; // Text string person = "Tom"; // Conditions: true or false bool isFirstLesson = true; string greeting1 = Greeter.Greet(person); Greeter.Print(person); System.Console.ReadLine(); string prntspellatt = SpellAttributes.Magesfire(); SpellAttributes.Print(prntspellatt); System.Console.ReadLine(); }
public void ShouldReturnGreetString2(string name, bool exclamation) { var greeter = new Greeter(); var greetingString = greeter.Greet(name, exclamation); Assert.Equal(exclamation ? $"Hello, {name}!" : $"Hello, {name}", greetingString); }
private async void TheButton_OnClick(object sender, RoutedEventArgs e) { var greeter = new Greeter(); var dialog = new MessageDialog(greeter.Greet()); await dialog.ShowAsync(); }
public void Call_to_greet_should_return_HelloWorld() { var greeter = new Greeter(); string message = greeter.Greet(); Assert.Equal(message, "Hello World"); }
public void TestGreet() { const string testName = "Tobi"; Greeter greeter = new Greeter(); StringAssert.Contains(greeter.Greet(testName), testName); }
public void SaysHello() { var greeter = new Greeter(); var greet = greeter.Greet(); Assert.That(greet, Contains.Substring("hello")); }
private void TextBox1_TextChanged(object sender, EventArgs e) { string who = textBox1.Text; string greeting = greeter.Greet(who); label2.Text = greeting; }
public void Greet_ShouldReturnBirthdayMessage_WhenDayIsTheSame() { var greeter = new Greeter(); var response = greeter.Greet("Name", new DateTime(2000, 6, 28).AddMinutes(5)); response.ShouldBe("Hello, Name. Today is your birthday!."); }
public void Greet_ShouldNotReturnBirthdayMessageWhenTodayIsNotYourBirthday() { var greeter = new Greeter(); var response = greeter.Greet("Name", new DateTime(2000, 6, 29)); response.ShouldNotBe("Hello, Name. Today is your birthday!."); }
public void Greet_NameIsInterpolatedInGreeting(string name) { var greeter = new Greeter(); var response = greeter.Greet(name, null); response.ShouldBe($"Hello, {name}."); }
public void ShouldGenerateTheCorrectGreeting(string[] names, string expectedGreeting) { //Act var greeting = _greeter.Greet(names); //Assert Assert.That(greeting, Is.EqualTo(expectedGreeting)); }
public void Main (string[] args) { var greeter = new Greeter(); var name = args.Length > 0 ? args[0] : "Dude"; greeter.Greet(name); ReadLine(); }
public Form1() { InitializeComponent(); string person = "Tom"; string greeting1 = Greeter.Greet(person); label1.Text = greeting1; }
public void Greet_OutputsGreetingWithName_WhenNamePassed() { IGreeter greeter = new Greeter(); var result = greeter.Greet("Tom"); result.ShouldBe("Hello, Tom!"); }
public void Greet() { var greeter = new Greeter(); var greet = greeter.Greet("Mercedes"); Assert.Equal("Hello, Mercedes", greet); }
static void Main(string[] args) { var greeter = new Greeter(); System.Console.WriteLine(greeter.Greet("bob")); System.Console.ReadLine(); }
public void Greet_ReturnGenericGreetingWhenNullName() { var greeter = new Greeter(); var response = greeter.Greet(null, null); response.ShouldBe("Hello, my friend."); }
public void GivenBob_ReturnsRegularGreeting() { var sut = new Greeter(); var expectedGreeting = "Hello, Bob."; var actualGreeting = sut.Greet("Bob"); Assert.AreEqual(expectedGreeting, actualGreeting); }
public void GivenNull_ReturnsMyFriendGreeting() { var sut = new Greeter(); var expectedGreeting = "Hello, my friend."; var actualGreeting = sut.Greet((string)null); Assert.AreEqual(expectedGreeting, actualGreeting); }
public void GivenMARSHAL_ReturnsAllCapsGreeting() { var sut = new Greeter(); var expectedGreeting = "HELLO MARSHALL!"; var actualGreeting = sut.Greet("MARSHALL"); Assert.AreEqual(expectedGreeting, actualGreeting); }
public void GivenTwoNames_ReturnsGreetingForEachName() { var sut = new Greeter(); var expectedGreeting = "Hello, Jill and Jane."; var actualGreeting = sut.Greet(new [] { "Jill", "Jane" }); Assert.AreEqual(expectedGreeting, actualGreeting); }
public void GivenMoreThanTwoNames_ReturnsGreetingForEachName() { var sut = new Greeter(); var expectedGreeting = "Hello, Amy, Brian, and Charlotte."; var actualGreeting = sut.Greet(new [] { "Amy", "Brian", "Charlotte" }); Assert.AreEqual(expectedGreeting, actualGreeting); }
public void GivenMoreThanTwoNames_AndOneIsShouted_ReturnsGreetingForEachName_AndShoutsUppercaseName() { var sut = new Greeter(); var expectedGreeting = "Hello, Amy and Charlotte. AND HELLO BRIAN!"; var actualGreeting = sut.Greet(new [] { "Amy", "BRIAN", "Charlotte" }); Assert.AreEqual(expectedGreeting, actualGreeting); }
public void CanGreet() { var greeter=new Greeter(); string greet = greeter.Greet(); Assert.AreEqual("Hello World", greet); }
public void DoSomething() { var greeter = new Greeter(new Writer()); greeter.Greet(); }