Esempio n. 1
0
        public async Task TestStartCreatesNewResponseWhenNoCurrentResponseThenRedirects()
        {
            // Arrange
            var clientStorage = Substitute.For <IClientSideStorageService>();
            var dateTime      = Substitute.For <IDateTimeService>();
            var repo          = Substitute.For <ISurveyResponseRepository>();

            repo.Create().Returns(SurveyResponse.CreateNew(FakeNow));
            var controller = new SurveyController(clientStorage, dateTime, null, null, repo);

            // Act
            var result = await controller.Start();

            // Assert
            await repo.Received().Create();

            Assert.IsType <RedirectToActionResult>(result);
        }