コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Greeter.cs プロジェクト: datamatiker2018/Week-11
    public static void Main()
    {
        Greeter greeter = new Greeter("Hello ");

        greeter.Greet("Rune");
        greeter.Greet("Rune", true);

        Console.Read();
    }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public void GivenAName_WhenGreeted_ThenSaluationContainsName()
        {
            var greeter  = new Greeter();
            var greeting = greeter.Greet("Bob");

            Assert.Equal("Hello Bob", greeting);
        }
コード例 #6
0
        public void TestGreet()
        {
            const string testName = "Tobi";
            Greeter      greeter  = new Greeter();

            Assert.That(greeter.Greet(testName).Contains(testName));
        }
コード例 #7
0
        public void CanGreet()
        {
            var    greeter = new Greeter();
            string greet   = greeter.Greet();

            Assert.AreEqual("Hello World", greet);
        }
コード例 #8
0
        public void ShouldReturnGreetString()
        {
            var greeter        = new Greeter();
            var greetingString = greeter.Greet("Anon");

            Assert.Equal("Hello, Anon", greetingString);
        }
コード例 #9
0
        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();
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        private async void TheButton_OnClick(object sender, RoutedEventArgs e)
        {
            var greeter = new Greeter();
            var dialog  = new MessageDialog(greeter.Greet());

            await dialog.ShowAsync();
        }
コード例 #12
0
        public void Call_to_greet_should_return_HelloWorld()
        {
            var    greeter = new Greeter();
            string message = greeter.Greet();

            Assert.Equal(message, "Hello World");
        }
コード例 #13
0
        public void TestGreet()
        {
            const string testName = "Tobi";
            Greeter      greeter  = new Greeter();

            StringAssert.Contains(greeter.Greet(testName), testName);
        }
コード例 #14
0
        public void SaysHello()
        {
            var greeter = new Greeter();
            var greet   = greeter.Greet();

            Assert.That(greet, Contains.Substring("hello"));
        }
コード例 #15
0
        private void TextBox1_TextChanged(object sender, EventArgs e)
        {
            string who      = textBox1.Text;
            string greeting = greeter.Greet(who);

            label2.Text = greeting;
        }
コード例 #16
0
ファイル: GreeterTests.cs プロジェクト: GregSam/tdd-katas
        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!.");
        }
コード例 #17
0
ファイル: GreeterTests.cs プロジェクト: GregSam/tdd-katas
        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!.");
        }
コード例 #18
0
ファイル: GreeterTests.cs プロジェクト: GregSam/tdd-katas
        public void Greet_NameIsInterpolatedInGreeting(string name)
        {
            var greeter = new Greeter();

            var response = greeter.Greet(name, null);

            response.ShouldBe($"Hello, {name}.");
        }
コード例 #19
0
        public void ShouldGenerateTheCorrectGreeting(string[] names, string expectedGreeting)
        {
            //Act
            var greeting = _greeter.Greet(names);

            //Assert
            Assert.That(greeting, Is.EqualTo(expectedGreeting));
        }
コード例 #20
0
	public void Main (string[] args)
    {
		
        var greeter = new Greeter();
		var name = args.Length > 0 ? args[0] : "Dude";
		greeter.Greet(name);
		ReadLine();
    }
コード例 #21
0
        public Form1()
        {
            InitializeComponent();
            string person    = "Tom";
            string greeting1 = Greeter.Greet(person);

            label1.Text = greeting1;
        }
コード例 #22
0
        public void Greet_OutputsGreetingWithName_WhenNamePassed()
        {
            IGreeter greeter = new Greeter();

            var result = greeter.Greet("Tom");

            result.ShouldBe("Hello, Tom!");
        }
コード例 #23
0
    public void Greet()
    {
        var greeter = new Greeter();

        var greet = greeter.Greet("Mercedes");

        Assert.Equal("Hello, Mercedes", greet);
    }
コード例 #24
0
ファイル: Program.cs プロジェクト: PercyODI/stage2videos
        static void Main(string[] args)
        {
            var greeter = new Greeter();

            System.Console.WriteLine(greeter.Greet("bob"));

            System.Console.ReadLine();
        }
コード例 #25
0
ファイル: GreeterTests.cs プロジェクト: GregSam/tdd-katas
        public void Greet_ReturnGenericGreetingWhenNullName()
        {
            var greeter = new Greeter();

            var response = greeter.Greet(null, null);

            response.ShouldBe("Hello, my friend.");
        }
コード例 #26
0
        public void GivenBob_ReturnsRegularGreeting()
        {
            var sut = new Greeter();

            var expectedGreeting = "Hello, Bob.";
            var actualGreeting   = sut.Greet("Bob");

            Assert.AreEqual(expectedGreeting, actualGreeting);
        }
コード例 #27
0
        public void GivenNull_ReturnsMyFriendGreeting()
        {
            var sut = new Greeter();

            var expectedGreeting = "Hello, my friend.";
            var actualGreeting   = sut.Greet((string)null);

            Assert.AreEqual(expectedGreeting, actualGreeting);
        }
コード例 #28
0
        public void GivenMARSHAL_ReturnsAllCapsGreeting()
        {
            var sut = new Greeter();

            var expectedGreeting = "HELLO MARSHALL!";
            var actualGreeting   = sut.Greet("MARSHALL");

            Assert.AreEqual(expectedGreeting, actualGreeting);
        }
コード例 #29
0
        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);
        }
コード例 #30
0
        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);
        }
コード例 #31
0
        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);
        }
コード例 #32
0
 public void CanGreet()
 {
     var greeter=new Greeter();
     string greet = greeter.Greet();
     Assert.AreEqual("Hello World", greet);
 }
コード例 #33
0
ファイル: GreeterClient.cs プロジェクト: philiplaureano/Taiji
 public void DoSomething()
 {
     var greeter = new Greeter(new Writer());
     greeter.Greet();
 }
コード例 #34
0
 public void SaysHello()
 {
     var greeter = new Greeter();
     var greet = greeter.Greet();
     Assert.That(greet, Contains.Substring("hello"));
 }