public void SayHelloWorld() { INameSource nameSource = MockRepository.Mock <INameSource>(); nameSource.Expect(x => x.CreateName(null, null)) .IgnoreArguments() .DoInstead(new NameSourceDelegate(Formal)); string expected = "Hi, my name is Ayende Rahien"; string actual = new Speaker("Ayende", "Rahien", nameSource) .Introduce(); Assert.Equal(expected, actual); }
public void SayHelloWorld_AAA() { //Arrange INameSource nameSource = MockRepository.GenerateStrictMock <INameSource>(); nameSource.Expect(n => n.CreateName(null, null)).IgnoreArguments(). Do(new NameSourceDelegate(Formal)); //Act string actual = new Speaker("Ayende", "Rahien", nameSource).Introduce(); //Assert string expected = "Hi, my name is Ayende Rahien"; Assert.AreEqual(expected, actual); nameSource.VerifyAllExpectations(); }