private void GreetBtn_Click(object sender, RoutedEventArgs e) { var service = new GreetService(); var name = NameTxt.Text; var greeting = service.Greet(name); ResultTxt.Text = greeting; }
public void should_greet_with_correct_parameters() { var actualGreeting = greetService.Greet(TestName); const string expectedGreeting = "Hello, John!\nMy secret is - My Secret\nYour Personal info - Personal Info\nBye"; Assert.That(actualGreeting, Is.EqualTo(expectedGreeting)); }
public void Greet_NameAdded_ReturnGreetings() { // Arrange var service = new GreetService(); // Act var greeting = service.Greet(".NET Padawan"); // Assert Assert.AreEqual("Welcome .NET Padawan, my friend!", greeting); }
public void GreetService_HaveGreatDay() { Shim shim = Shim.Replace(() => DateTime.Now).With(() => new DateTime(2019, 2, 20, 20, 50, 0)); var greetService = new GreetService(); var response = string.Empty; PoseContext.Isolate(() => { response = greetService.Greet(); }, shim); Assert.Equal("Have a great day!", response); }
public void GreetService_GoodMorning(string time) { var dateTime = Convert.ToDateTime(time); Shim shim = Shim.Replace(() => DateTime.Now).With(() => dateTime); var greetService = new GreetService(); var response = string.Empty; PoseContext.Isolate(() => { response = greetService.Greet(); }, shim); Assert.Equal("Good morning!", response); }