Esempio n. 1
0
        public void ReturnsContentEditor(ContentEditViewModel content, Type expectedResultType)
        {
            var fakeId = -1;
            var fakeContentRepository = new Mock <IContentEditorRepository>();

            fakeContentRepository.Setup(x => x.Read(fakeId)).Returns(content);
            var subject = new ContentsController(fakeContentRepository.Object);

            var actionResult = subject.Edit(fakeId);

            Assert.IsType(expectedResultType, actionResult);
        }
Esempio n. 2
0
        public void ChangesContent()
        {
            var fakeContent           = new ContentEditViewModel();
            var fakeContentRepository = new Mock <IContentEditorRepository>();

            fakeContentRepository.Setup(x => x.Update(fakeContent)).Returns(fakeContent);
            var subject = new ContentsController(fakeContentRepository.Object);

            var actionResult = subject.Edit(fakeContent);

            fakeContentRepository.Verify(x => x.Update(fakeContent));
            Assert.IsType(typeof(RedirectToActionResult), actionResult);
        }