Пример #1
0
        public void AllHospitalsHttpShouldBeEmptyTest()
        {
            var mockHospitalsService   = new Mock <IHospitalsService>();
            var mockUserManagerService = this.GetUserManagerMock();
            var mockRecipientsService  = new Mock <IRecipientsService>();
            var mockBloodbanksService  = new Mock <IBloodBanksService>();
            var mockUsersService       = new Mock <IUsersService>();
            var viewModel = new AllHospitalsViewModel();

            var controller = new HospitalsController(
                mockHospitalsService.Object,
                mockUserManagerService.Object,
                mockRecipientsService.Object,
                mockBloodbanksService.Object,
                mockUsersService.Object);

            var result = controller.AllHospitals(viewModel);

            Assert.IsType <ViewResult>(result);

            var viewResult = result as ViewResult;

            Assert.IsType <AllHospitalsViewModel>(viewResult.Model);

            viewModel = viewResult.Model as AllHospitalsViewModel;
            var actualResult = viewModel.Hospitals.Count();

            Assert.Equal(0, actualResult);
        }
Пример #2
0
        public void AllHospitalsShouldReturnCorrectViewModelTest()
        {
            var mockHospitalsService   = new Mock <IHospitalsService>();
            var mockUserManagerService = this.GetUserManagerMock();
            var mockRecipientsService  = new Mock <IRecipientsService>();
            var mockBloodbanksService  = new Mock <IBloodBanksService>();
            var mockUsersService       = new Mock <IUsersService>();
            var viewModel = new AllHospitalsViewModel();

            var controller = new HospitalsController(
                mockHospitalsService.Object,
                mockUserManagerService.Object,
                mockRecipientsService.Object,
                mockBloodbanksService.Object,
                mockUsersService.Object);

            var result = controller.AllHospitals(viewModel);

            Assert.IsType <ViewResult>(result);
        }