什么是AAA语法等同于使用排序()在犀牛制品 [英] What is the AAA syntax equivalent to using Ordered() in Rhino Mocks

查看:156
本文介绍了什么是AAA语法等同于使用排序()在犀牛制品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能为我的生活找到使用犀牛流利/ AAA语法验证操作的顺序正确的语法。

I can't for the life of me find the proper syntax using the Fluent/AAA syntax in Rhino for validating order of operations.

我知道该怎么做这与老同学记录/回放语法:

I know how to do this with the old school record/playback syntax:

        MockRepository repository = new MockRepository();
        using (repository.Ordered())
        {
            // set some ordered expectations
        }

        using (repository.Playback())
        {
            // test
        }

谁能告诉我是什么相当于这个在犀牛制品AAA语法会。 。更妙的是,如果你可以点我一些这方面的资料。

Can anyone tell me what the equivalent to this in AAA syntax for Rhino Mocks would be. Even better if you can point me to some documentation for this.

推荐答案

试试这个:

  //
  // Arrange
  //
  var mockFoo = MockRepository.GenerateMock<Foo>();
  mockFoo.GetRepository().Ordered();
  // or mockFoo.GetMockRepository().Ordered() in later versions

  var expected = ...;
  var classToTest = new ClassToTest( mockFoo );
  // 
  // Act
  //
  var actual = classToTest.BarMethod();

  //  
  // Assert
  //
  Assert.AreEqual( expected, actual );
 mockFoo.VerifyAllExpectations();

这篇关于什么是AAA语法等同于使用排序()在犀牛制品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆