예제 #1
0
        public void Edit_a_term()
        {
            const int termId = 1;
            var editedTerm = Builder<TermViewModel>.CreateNew().Build();
            var vm = new ModifyTermViewModel { Id = termId, TermViewModel = editedTerm };
            _glossaryRepo.GetTerm(termId).Returns(new GlossaryTerm { Id = termId, Definition = editedTerm.Definition, Term = editedTerm.Term });
            var controller = new HomeController(_glossaryRepo);

            controller.EditTerm(vm);

            _glossaryRepo.Received().SaveTerm(Arg.Is<GlossaryTerm>(t => t.Term == editedTerm.Term && t.Definition == editedTerm.Definition && t.Id == termId));
        }
예제 #2
0
 public void Setup()
 {
     _glossaryRepo = Substitute.For<IGlossaryRepository>();
     _controller = new HomeController(_glossaryRepo);
 }