Beispiel #1
0
        // GET: Rechts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            EditRechtViewModel editRechtViewModel =
                RechtViewModelService.Map_Recht_EditRechtViewModel(RechtService.SearchRightById(Convert.ToInt32(id)));

            if (editRechtViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(editRechtViewModel));
        }
        public void Map_RechteViewModel_EditRecht_Test()
        {
            //Assert
            var recht = Fixture.Build <Recht>().Create();
            var editRechtViewModel = Fixture.Build <EditRechtViewModel>().Create();
            var mockMapper         = new Mock <IMapper>();

            mockMapper.Setup(m => m.Map <EditRechtViewModel>(It.IsAny <Recht>())).Returns(editRechtViewModel);
            MockMapper = mockMapper.Object;

            var rechtViewModelService = new RechtViewModelService();

            //Act
            var result = rechtViewModelService.Map_Recht_EditRechtViewModel(recht);

            //Assert

            Assert.AreEqual(editRechtViewModel.GetType(), result.GetType());
        }