コード例 #1
0
ファイル: DoHanlderTests.cs プロジェクト: Mrxx99/rhino-mocks
        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);
        }
コード例 #2
0
        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();
        }