- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
对于我的测试,我需要第一次调用 stub 来返回一个对象,下一次调用返回一个不同的对象。我已经在 record() block 中的其他模拟对象框架中看到了这一点,但我还没有弄清楚如何在 FakeItEasy 中做到这一点。 FakeItEasy 是我们商店的强制框架,我正在使用 AutoFixture 来生成假货。
我查看了 NextCall,但看起来我无法指定返回值。
这是我想做的事情的想法:
ReceiveMessageResponse queueResponse1 = fixture.Create<ReceiveMessageResponse>();
ReceiveMessageResponse queueResponse2 = fixture.Create<ReceiveMessageResponse>(seed);
A.CallTo(() => sqsClient.ReceiveMessage(null)).WithAnyArguments().Returns(queueResponse1);
//The following should happen the second time...
A.CallTo(() => sqsClient.ReceiveMessage(null)).WithAnyArguments().Returns(queueResponse2);
感谢任何帮助。
最佳答案
有两种方法,其中一种是您在自己的答案中提到的方法:
A.CallTo(() => foo.Bar()).ReturnsNextFromSequence(new[] { response1, response2 });
另一种方式是:
A.CallTo(() => foo.Bar()).Returns(response2);
A.CallTo(() => foo.Bar()).Returns(response1).Once();
关于unit-testing - 从 FakeItEasy A.CallTo() 返回不同的对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15253279/
我正在尝试创建一个简单的测试来检查是否调用了 elasticsearch 客户端的搜索方法。 public async Task> MySearch(string term) {
使用 FakeItEasy,我如何检查我的对象的方法是否调用了同一对象上的另一个方法? 测试: [TestMethod] public void EatBanana_CallsWillEat() {
这个问题已经有答案了: How to detect a mobile device with JavaScript? (21 个回答) How to detect a page request is
对于我的测试,我需要第一次调用 stub 来返回一个对象,下一次调用返回一个不同的对象。我已经在 record() block 中的其他模拟对象框架中看到了这一点,但我还没有弄清楚如何在 FakeIt
我正在尝试跟踪单击按钮时的调用电话事件。我的 GA 代码是从设置向导中提供的。 window.dataLayer = window.dataLayer || []
我正在尝试测试一种方法,该方法具有创建 IDisposable 类型的新具体实例的 using 语句。 为此,我试图伪造一个在 IDisposable 类型的构造函数中执行的私有(private)方法
我正在尝试从 infowindow 获取变量到 mysql。 我在信息窗口中有 3 个链接 1-callto2 封邮件3-网页访问 downloadUrl("gen_xml.php", functio
有人能告诉我如何让这样的 anchor 标签不受影响地通过 htmlpurifier 吗? : ... 用我的配置。设置,callto:... 值未被识别为允许的,因此整个 href 属性被删除。我想
我以前用C#写过 var provider = A.Fake(); A.CallTo(() => provider.Fetch()).ReturnsLazily(call => data[0]); c
您好,我正在尝试制作包含如下服务链接的移动网站: *000# 我尝试对特殊字符和htmlentetries进行编码,但没有结果,出现了调用框,但单击调用后没有任何操作。 最佳答案 tel: URI 方
我的任务是创建一个 WPF 应用程序,当用户在浏览器(Chome,IE)中单击 callto: 和 tel: 链接时,打开它们的默认应用程序是我创建的 Windows 10 WPF 应用程序并处理它们
我是一名优秀的程序员,十分优秀!