arrange-act-assert

Rhino Mocks AAA Quick Start?

拥有回忆 提交于 2019-12-29 06:10:08
问题 I've been looking around for some decent information on using Rhino Mocks 3.5+ with the AAA syntax. I find a lot of blogs that have a mix of things from the old and new which seem to make it more difficult to figure out how to use it. Would would be great would be if there were a Rhino Mocks AAA Cheat Sheet like was done for an earlier version. Is it required that you know everything about the older versions of Rhino to actually use the newer version? I'm sure if I were an expert that I would

Mixing Assert and Act in AAA unit testing syntax

强颜欢笑 提交于 2019-12-10 16:00:56
问题 Is it OK to mix Assert and Act steps? Is AAA more of a guideline than a rule? Or am I missing something? Here is my test: [TestMethod] public void CancelButtonSelected_DontCancelTwiceThenCancel_DialogCloses() { // Arrange IAddAddressForm form = Substitute.For<IAddAddressForm>(); // Indicate that when Show CancelMessage is called it // should return cancel twice (saying we want to cancel the cancel) // then it should return ok form.ShowCancelMessage().Returns(DialogResult.Cancel, DialogResult

RhinoMocks AAA Syntax

為{幸葍}努か 提交于 2019-12-08 02:34:34
问题 I've spent a good part of the day trying to figure out why a simple RhinoMocks test doesn't return the value I'm setting in the return. I'm sure that I'm just missing something really simple but I can't figure it out. Here's my test: [TestMethod] public void CopyvRAFiles_ShouldCallCopyvRAFiles_ShouldReturnTrue2() { FileInfo fi = new FileInfo(@"c:\Myprogram.txt"); FileInfo[] myFileInfo = new FileInfo[2]; myFileInfo[0] = fi; myFileInfo[1] = fi; var mockSystemIO = MockRepository.GenerateMock

Arrange Act Assert Alternatives

谁都会走 提交于 2019-12-06 20:44:27
问题 The general question is are there alternative patterns to AAA for unit testing ? If, yes, would be very interesting to see some examples and hear about their pros and cons. And as the simplest example of AAA test (in c#, using var for the sake of simplicity): // Arranging var annualSalary = 120000M; var period = 3; // for a quarter profit var calc = new SalaryCalculator(); // Acting var result = calc.CalculateProfit(annualSalary, period); // Assertion Assert.IsEqual(40000, result); 回答1: I

Rhino Mocks AAA Quick Start?

痴心易碎 提交于 2019-11-29 03:53:21
I've been looking around for some decent information on using Rhino Mocks 3.5+ with the AAA syntax. I find a lot of blogs that have a mix of things from the old and new which seem to make it more difficult to figure out how to use it. Would would be great would be if there were a Rhino Mocks AAA Cheat Sheet like was done for an earlier version. Is it required that you know everything about the older versions of Rhino to actually use the newer version? I'm sure if I were an expert that I would love all the capabilities in Rhino, but for now I'm just swimming in information. Any pointers or good

Should it be “Arrange-Assert-Act-Assert”?

情到浓时终转凉″ 提交于 2019-11-26 11:57:17
问题 Regarding the classic test pattern of Arrange-Act-Assert, I frequently find myself adding a counter-assertion that precedes Act. This way I know that the passing assertion is really passing as the result of the action. I think of it as analogous to the red in red-green-refactor, where only if I\'ve seen the red bar in the course of my testing do I know that the green bar means I\'ve written code that makes a difference. If I write a passing test, then any code will satisfy it; similarly, with