public async Task CreateHospitalThrowsExceptionUserShouldBeRegisteredFirstTest()
        {
            var dbContext = ApplicationDbContextInMemoryFactory.InitializeContext();

            MapperInitializer.InitializeMapper();

            var hospitalDataRepository      = new EfDeletableEntityRepository <HospitalData>(dbContext);
            var usersRepository             = new EfDeletableEntityRepository <ApplicationUser>(dbContext);
            var rolesRepository             = new EfDeletableEntityRepository <ApplicationRole>(dbContext);
            var appUsersHospitalRepository  = new EfDeletableEntityRepository <ApplicationUserHospitalData>(dbContext);
            var recipientRepository         = new EfDeletableEntityRepository <Recipient>(dbContext);
            var bloodBankRepository         = new EfDeletableEntityRepository <BloodBank>(dbContext);
            var hospitalBloodBankRepository = new EfDeletableEntityRepository <HospitalDataBloodBank>(dbContext);
            var bagRepository = new EfDeletableEntityRepository <BloodBag>(dbContext);

            var service = new HospitalsService(
                usersRepository,
                hospitalDataRepository,
                rolesRepository,
                appUsersHospitalRepository,
                recipientRepository,
                bloodBankRepository,
                hospitalBloodBankRepository,
                bagRepository);

            await Assert.ThrowsAsync <ArgumentException>(() => service.CreateHospitalProfileAsync(this.SeedInputs(), this.SeedInputs().Id));
        }
        public async Task CreateHospitalUserIsNotNullTest()
        {
            var dbContext = ApplicationDbContextInMemoryFactory.InitializeContext();

            MapperInitializer.InitializeMapper();

            var hospitalDataRepository      = new EfDeletableEntityRepository <HospitalData>(dbContext);
            var usersRepository             = new EfDeletableEntityRepository <ApplicationUser>(dbContext);
            var rolesRepository             = new EfDeletableEntityRepository <ApplicationRole>(dbContext);
            var appUsersHospitalRepository  = new EfDeletableEntityRepository <ApplicationUserHospitalData>(dbContext);
            var recipientRepository         = new EfDeletableEntityRepository <Recipient>(dbContext);
            var bloodBankRepository         = new EfDeletableEntityRepository <BloodBank>(dbContext);
            var hospitalBloodBankRepository = new EfDeletableEntityRepository <HospitalDataBloodBank>(dbContext);
            var bagRepository = new EfDeletableEntityRepository <BloodBag>(dbContext);

            var userManager = this.GetUserManagerMock();

            var service = new HospitalsService(
                usersRepository,
                hospitalDataRepository,
                rolesRepository,
                appUsersHospitalRepository,
                recipientRepository,
                bloodBankRepository,
                hospitalBloodBankRepository,
                bagRepository);

            await SeedDataAsync(dbContext);

            await service.CreateHospitalProfileAsync(this.SeedInputs(), this.SeedInputs().Id);

            var user = usersRepository.All().Where(u => u.UserName == "User1").FirstOrDefault();

            Assert.NotNull(user);
        }
        public async Task GetHospitalByUserIdShouldReturnNotNullTest()
        {
            var dbContext = ApplicationDbContextInMemoryFactory.InitializeContext();

            MapperInitializer.InitializeMapper();

            var hospitalDataRepository      = new EfDeletableEntityRepository <HospitalData>(dbContext);
            var usersRepository             = new EfDeletableEntityRepository <ApplicationUser>(dbContext);
            var rolesRepository             = new EfDeletableEntityRepository <ApplicationRole>(dbContext);
            var appUsersHospitalRepository  = new EfDeletableEntityRepository <ApplicationUserHospitalData>(dbContext);
            var recipientRepository         = new EfDeletableEntityRepository <Recipient>(dbContext);
            var bloodBankRepository         = new EfDeletableEntityRepository <BloodBank>(dbContext);
            var hospitalBloodBankRepository = new EfDeletableEntityRepository <HospitalDataBloodBank>(dbContext);
            var bagRepository = new EfDeletableEntityRepository <BloodBag>(dbContext);

            var userManager = this.GetUserManagerMock();

            var service = new HospitalsService(
                usersRepository,
                hospitalDataRepository,
                rolesRepository,
                appUsersHospitalRepository,
                recipientRepository,
                bloodBankRepository,
                hospitalBloodBankRepository,
                bagRepository);

            await SeedDataAsync(dbContext);

            await service.CreateHospitalProfileAsync(this.SeedInputs(), this.SeedInputs().Id);

            var result = service.GetHospitalDataById <HospitalProfileInputModel>("123", "123");

            Assert.NotNull(result);
        }