public void GivenAnIndexAction_WhenClientHasRecordings_ThenShowsTheRecordings() { var mockClient = new Mock <IClient>(); mockClient.Setup(c => c.Recordings()).Returns(new List <Recording> { new Recording { Uri = new Uri("/recording", UriKind.Relative), DateCreated = new DateTime(2015, 01, 01) }, new Recording { Uri = new Uri("/recording", UriKind.Relative), DateCreated = new DateTime(2015, 01, 01) } }); var stubPhoneNumbers = Mock.Of <IPhoneNumbers>(); var controller = new RecordingsController(mockClient.Object, stubPhoneNumbers); var result = controller.Index(); result.ExecuteResult(MockControllerContext.Object); var recordings = Json.Decode <IList <IDictionary <string, string> > >(Result.ToString()); Assert.That(recordings.Count, Is.EqualTo(2)); }
public void SetUp() { _controller = new RecordingsController(_repos); _vr = _controller.Index() as ViewResult; }