public void Test_CreateInstance_NoCallback_ThrowException() { object instance = null; Action callback = () => SingletonHelper.GetInstance(ref instance, null); callback.Should().Throw <ArgumentException>(); }
private IUnitOfWork GetUnitOfWorkInstance() { return(SingletonHelper.GetInstance(ref _unitOfWork, () => { var appSettings = ConfigurationHelper.GetValues(_databaseJsonKey); return new UnitOfWorkFactory().Create(new ConnectionFactory(appSettings[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); }
public IReservationService CreateReservationService() { return(SingletonHelper.GetInstance(ref _reservationService, () => new ReservationService(GetUnitOfWorkInstance(), CreateInfrastructureService()))); }
public IInfrastructureService CreateInfrastructureService() { return(SingletonHelper.GetInstance(ref _infrastructureService, () => new InfrastructureService(GetUnitOfWorkInstance()))); }
public IUserService CreateUserService() { return(SingletonHelper.GetInstance(ref _userService, () => new UserService(GetUnitOfWorkInstance()))); }
public IScheduleService CreateScheduleService() { return(SingletonHelper.GetInstance(ref _scheduleService, () => new ScheduleService(GetUnitOfWorkInstance()))); }
public IMovieService CreateMovieService() { return(SingletonHelper.GetInstance(ref _movieService, () => new MovieService(GetUnitOfWorkInstance()))); }
public ICheckoutService CreateCheckoutService() { return(SingletonHelper.GetInstance(ref _checkoutService, () => new CheckoutService(_unitOfWork, new PaymentFactory()))); }