コード例 #1
0
        public PrescriptionTests()
        {
            SeedData();

            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json")
                                    .Build();

            var mockMapper = new MapperConfiguration(cfg => cfg.AddProfile(new MappingProfile()));
            var mapper     = mockMapper.CreateMapper();

            var userManager   = MockUserManager.GetMockUserManager(_fakeIdentityUsers).Object;
            var signInManager = MockSigninManager.GetSignInManager <IdentityUser>(userManager).Object;

            IdentityRepositoryFake = new IdentityRepository(userManager, signInManager, config);
            var fakeGenericRepo = MockGenericRepository.GetUserInformationMock(_fakeEntities);

            var fakeGenericRepoUserInformationMock = MockGenericRepository.GetUserInformationMock(_fakeUsersInformation);

            MockUserExtension.ExtendMock(fakeGenericRepoUserInformationMock, _fakeUsersInformation);

            var userInformationMock = MockGenericRepository.GetUserInformationMock(_patients);
            var constulatationsMock = MockGenericRepository.GetUserInformationMock(_constulatations);

            MockGenericExtension.ExtendMock(fakeGenericRepo, _fakeEntities);
            FakeController = new PrescriptionsController(IdentityRepositoryFake, fakeGenericRepo.Object, fakeGenericRepoUserInformationMock.Object, userInformationMock.Object,
                                                         constulatationsMock.Object,
                                                         mapper);

            IdentityHelper.SetUser(_fakeIdentityUsers[0], FakeController);
        }
コード例 #2
0
        public AdditionalExaminationResultsTests()
        {
            SeedData();

            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json")
                                    .Build();

            var mockMapper = new MapperConfiguration(cfg => cfg.AddProfile(new MappingProfile()));
            var mock       = mockMapper.CreateMapper();

            var userManager   = MockUserManager.GetMockUserManager(_fakeIdentityUsers).Object;
            var signInManager = MockSigninManager.GetSignInManager <IdentityUser>(userManager).Object;

            IdentityRepositoryFake = new IdentityRepository(userManager, signInManager, config);
            var fakeGenericRepo  = MockGenericRepository.GetUserInformationMock(_fakeEntities);
            var constulationRepo = MockGenericRepository.GetUserInformationMock(_consultations);
            var patientRepo      = MockGenericRepository.GetUserInformationMock(_fakeUsersPatient);
            var typeRepo         = MockGenericRepository.GetUserInformationMock(_types);

            MockGenericExtension.ExtendMock(fakeGenericRepo, _fakeEntities);

            FakeController = new AdditionalExaminationResultsController(IdentityRepositoryFake, fakeGenericRepo.Object,
                                                                        constulationRepo.Object,
                                                                        patientRepo.Object,
                                                                        typeRepo.Object,
                                                                        mock);

            IdentityHelper.SetUser(_fakeIdentityUsers[0], FakeController);
        }