예제 #1
0
        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);
        }
예제 #2
0
        public async Task WhatShouldHappen()
        {
            var greeter  = new Greeter();
            var greeting = await greeter.GetGreeting();

            Assert.Equal("Hello, world", greeting);
        }
예제 #3
0
        public void Should_return_valid_greeting(string name, string expected)
        {
            Greeter greeter = new Greeter(name);
            var     result  = greeter.GetGreeting();

            Assert.Equal(expected, result);
        }
예제 #4
0
        public void Should_return_greeting_if_name_is_Bob()
        {
            Greeter greeter = new Greeter("Bob");
            var     result  = greeter.GetGreeting();

            Assert.Equal("Hi, Bob", result);
        }
예제 #5
0
            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);
            }
예제 #7
0
        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
        }
예제 #8
0
        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);
            }
예제 #10
0
            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);
                }
            }
예제 #11
0
        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());
        }
예제 #12
0
    public static void Main(string[] args)
    {
        var greeter = new Greeter();

        Console.WriteLine(greeter.GetGreeting());
    }
예제 #13
0
 public static void Main(string[] args)
 {
     Console.WriteLine(Greeter.GetGreeting("World"));
 }