예제 #1
0
        public void Test_CreateInstance_NoCallback_ThrowException()
        {
            object instance = null;
            Action callback = () => SingletonHelper.GetInstance(ref instance, null);

            callback.Should().Throw <ArgumentException>();
        }
예제 #2
0
 private IUnitOfWork GetUnitOfWorkInstance()
 {
     return(SingletonHelper.GetInstance(ref _unitOfWork, () =>
     {
         var appSettings = ConfigurationHelper.GetValues(_databaseJsonKey);
         return new UnitOfWorkFactory().Create(new ConnectionFactory(appSettings[0]));
     }));
 }
예제 #3
0
        public void Test_CreateInstance_Return_NewInstance()
        {
            const string expected = "Instance";
            string       instance = null;

            var result = SingletonHelper.GetInstance(ref instance, () => expected);

            result.Should().NotBeNull();
            result.Should().Be(expected);
        }
예제 #4
0
 public IReservationService CreateReservationService()
 {
     return(SingletonHelper.GetInstance(ref _reservationService,
                                        () => new ReservationService(GetUnitOfWorkInstance(), CreateInfrastructureService())));
 }
예제 #5
0
 public IInfrastructureService CreateInfrastructureService()
 {
     return(SingletonHelper.GetInstance(ref _infrastructureService,
                                        () => new InfrastructureService(GetUnitOfWorkInstance())));
 }
예제 #6
0
 public IUserService CreateUserService()
 {
     return(SingletonHelper.GetInstance(ref _userService, () => new UserService(GetUnitOfWorkInstance())));
 }
예제 #7
0
 public IScheduleService CreateScheduleService()
 {
     return(SingletonHelper.GetInstance(ref _scheduleService,
                                        () => new ScheduleService(GetUnitOfWorkInstance())));
 }
예제 #8
0
 public IMovieService CreateMovieService()
 {
     return(SingletonHelper.GetInstance(ref _movieService, () => new MovieService(GetUnitOfWorkInstance())));
 }
예제 #9
0
 public ICheckoutService CreateCheckoutService()
 {
     return(SingletonHelper.GetInstance(ref _checkoutService,
                                        () => new CheckoutService(_unitOfWork, new PaymentFactory())));
 }