public void Should_not_return_greeting_if_name_is_not_bob_or_alice() { Greeter greeter = new Greeter("Doug"); var result = greeter.GetGreeting(); Assert.Equal("", result); }
public async Task WhatShouldHappen() { var greeter = new Greeter(); var greeting = await greeter.GetGreeting(); Assert.Equal("Hello, world", greeting); }
public void Should_return_valid_greeting(string name, string expected) { Greeter greeter = new Greeter(name); var result = greeter.GetGreeting(); Assert.Equal(expected, result); }
public void Should_return_greeting_if_name_is_Bob() { Greeter greeter = new Greeter("Bob"); var result = greeter.GetGreeting(); Assert.Equal("Hi, Bob", result); }
public void Execute(HelloQuery query) { var greeting = _greeter.GetGreeting(query.Name); var queryResult = new HelloQueryResult { Greeting = greeting, }; query.SetResult(queryResult); }
public void Should_Greet_World() { // Given const string name = "World"; const string expect = "Hello World!"; // When var result = Greeter.GetGreeting(name); // Then Assert.Equal(expect, result); }
public string Index() { var greeter = new Greeter(); var greeting = greeter.GetGreeting(); #if ASPNET50 return(Assembly.GetExecutingAssembly().FullName); #endif #if ASPNETCORE50 return(typeof(HelloController).AssemblyQualifiedName); #endif }
public static int Main(string[] args) { var name = args.FirstOrDefault(); if (string.IsNullOrWhiteSpace(name)) { Console.WriteLine("Usage: HelloWorldApp [NAME]"); return(1); } Console.WriteLine(Greeter.GetGreeting(name)); return(0); }
public void Should_Throw_On_Null_Name() { // Given const string name = null; // When var result = Record.Exception(() => Greeter.GetGreeting(name)); // Then Assert.NotNull(result); Assert.IsType <ArgumentNullException>(result); Assert.Equal($"Value cannot be null. (Parameter 'name')", result.Message); }
public void Should_Throw_On_Null_Name() { // Given string name = null; // When try { Greeter.GetGreeting(name); } catch (Exception result) { // Then Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(ArgumentNullException)); Assert.AreEqual($"Value cannot be null. (Parameter 'name')", result.Message); } }
public async Task WhatActuallyHappens() { var greeter = new Greeter(); var exception = await Assert.ThrowsAsync <TypeInitializationException>(() => greeter.GetGreeting()); Assert.Contains("Library e_sqlite3 not found", exception.ToString()); }
public static void Main(string[] args) { var greeter = new Greeter(); Console.WriteLine(greeter.GetGreeting()); }
public static void Main(string[] args) { Console.WriteLine(Greeter.GetGreeting("World")); }