Exemplo n.º 1
0
        public void Test_CreateInstance_NoCallback_ThrowException()
        {
            object instance = null;
            Action callback = () => SingletonHelper.GetInstance(ref instance, null);

            callback.Should().Throw <ArgumentException>();
        }
Exemplo n.º 2
0
 private IUnitOfWork GetUnitOfWorkInstance()
 {
     return(SingletonHelper.GetInstance(ref _unitOfWork, () =>
     {
         var appSettings = ConfigurationHelper.GetValues(_databaseJsonKey);
         return new UnitOfWorkFactory().Create(new ConnectionFactory(appSettings[0]));
     }));
 }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 public IReservationService CreateReservationService()
 {
     return(SingletonHelper.GetInstance(ref _reservationService,
                                        () => new ReservationService(GetUnitOfWorkInstance(), CreateInfrastructureService())));
 }
Exemplo n.º 5
0
 public IInfrastructureService CreateInfrastructureService()
 {
     return(SingletonHelper.GetInstance(ref _infrastructureService,
                                        () => new InfrastructureService(GetUnitOfWorkInstance())));
 }
Exemplo n.º 6
0
 public IUserService CreateUserService()
 {
     return(SingletonHelper.GetInstance(ref _userService, () => new UserService(GetUnitOfWorkInstance())));
 }
Exemplo n.º 7
0
 public IScheduleService CreateScheduleService()
 {
     return(SingletonHelper.GetInstance(ref _scheduleService,
                                        () => new ScheduleService(GetUnitOfWorkInstance())));
 }
Exemplo n.º 8
0
 public IMovieService CreateMovieService()
 {
     return(SingletonHelper.GetInstance(ref _movieService, () => new MovieService(GetUnitOfWorkInstance())));
 }
Exemplo n.º 9
0
 public ICheckoutService CreateCheckoutService()
 {
     return(SingletonHelper.GetInstance(ref _checkoutService,
                                        () => new CheckoutService(_unitOfWork, new PaymentFactory())));
 }