コード例 #1
0
 public void SubscriberSendsCorrectGreeting_WhenNameIsNotGiven()
 {
     Test(
         arrange: _ => new Subscriber {
         Name = null
     },
         act: arrangeResult => SubscriberComponent.GreetingFor(arrangeResult),
         assert: (arrangeResult, actResult) => Assert.AreEqual($"Dear subscriber", actResult)
         );
 }
コード例 #2
0
        public void SubscriberSendsCorrect_WhenNameIsGiven()
        {
            Test(
                arrange: _ =>
            {
                var subscriberName = "John";

                return(
                    Subscriber: new Subscriber {
                    Name = subscriberName
                },
                    SubscriberName: subscriberName.ToUpper()
                    );
            },
                act: arrangeResult => SubscriberComponent.GreetingFor(arrangeResult.Subscriber),
                assert: (arrangeResult, actResult) => Assert.AreEqual($"Dear {arrangeResult.SubscriberName}", actResult)
                );
        }