Exemplo n.º 1
0
 public GetSurveyListQueryHandlerTests(QueryTestFixture fixture)
 {
     _context = fixture.Context;
     _mapper  = fixture.Mapper;
     fixture.MockUserInformation.Setup(x => x.GetUser()).Returns(Task.FromResult("Test"));
     _getUserInformation = fixture.MockUserInformation.Object;
 }
Exemplo n.º 2
0
        public AnswerController(IApplicationDBContext db, ISurveyService surveys, IDateTimeService time, ISecurity security)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }
            this.db = db;

            if (time == null)
            {
                throw new ArgumentNullException(nameof(time));
            }
            this.time = time;

            if (security == null)
            {
                throw new ArgumentNullException(nameof(security));
            }
            this.security = security;

            if (surveys == null)
            {
                throw new ArgumentNullException(nameof(surveys));
            }
            this.surveys = surveys;
        }
Exemplo n.º 3
0
        public void Setup()
        {
            var services = new ServiceCollection();

            //services.AddTransient<IConfiguration>(provider => PopulateTestData.GetConfiguration(TestContext.CurrentContext.TestDirectory));
            services.AddDbContext <ApplicationDbContext>(options => options.UseInMemoryDatabase());
            services.AddTransient <IApplicationDBContext, ApplicationDbContext>();
            //services.AddTransient<ISampleEntityService, SampleEntityService>();
            //services.AddTransient<SampleTestEntitiesController>();

            //var serviceProvider = services.BuildServiceProvider();
            //_applicationDBContext = serviceProvider.GetService<IApplicationDBContext>();
            //_SampleEntityService = serviceProvider.GetService<ISampleEntityService>();
            //_SampleEntitiesController = serviceProvider.GetService<SampleTestEntitiesController>();


            var container    = new WindsorContainer();
            var assemblyName = typeof(aspnetcoreoauth.Startup).Assembly.GetName().Name;

            container.Register(Component.For <IApplicationDBContext, ApplicationDbContext>().LifestyleTransient());
            container
            .Register(
                Component.For <ISampleEntityService, SampleEntityService>()
                .LifestyleTransient());
            container
            .Register(
                Classes.FromAssemblyNamed(assemblyName).Pick().If(p => p.Name.EndsWith("Controller"))
                .LifestyleTransient());

            var serviceProvider = WindsorRegistrationHelper.CreateServiceProvider(container, services);

            _applicationDBContext     = container.Resolve <IApplicationDBContext>();
            _SampleEntitiesController = container.Resolve <SampleTestEntitiesController>();
            _SampleEntityService      = container.Resolve <ISampleEntityService>();
        }
Exemplo n.º 4
0
        public SurveyService(IApplicationDBContext db)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            this.db = db;
        }
Exemplo n.º 5
0
        public HomeController(IApplicationDBContext db, ISecurity security)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            this.db = db;

            if (security == null)
            {
                throw new ArgumentNullException(nameof(security));
            }

            this.security = security;
        }
Exemplo n.º 6
0
        public AutomationController(IEmailService emailService, IApplicationDBContext db, IDateTimeService time)
        {
            this.emailService = emailService;

            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }
            this.db = db;

            if (time == null)
            {
                throw new ArgumentNullException(nameof(time));
            }
            this.time = time;
        }
Exemplo n.º 7
0
        public SurveyController(IApplicationDBContext db, ISurveyService surveys, ISecurity security)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            this.db = db;

            if (security == null)
            {
                throw new ArgumentNullException(nameof(security));
            }
            this.security = security;

            if (surveys == null)
            {
                throw new ArgumentNullException(nameof(surveys));
            }
            this.surveys = surveys;
        }
Exemplo n.º 8
0
        public SampleTestEntityValidator(IApplicationDBContext context)
        {
            int entityId = 0;

            CascadeMode = CascadeMode.StopOnFirstFailure;
            When(entity => {
                entityId = entity.Id;
                return(true);
            }, () =>
            {
                RuleFor(x => x.Name)
                .NotEmpty().WithMessage("Name is required")
                .MustAsync(async(name, cancellation)
                           => !((await context
                                 .SampleTestEntity
                                 .Where(t => (entityId > 0 && t.Id != entityId && t.Name.ToLower().Trim() == name.ToLower().Trim()) ||         // while updating exiting entity
                                        (entityId == 0 && t.Name.ToLower().Trim() == name.ToLower().Trim()))                    // while adding new entity
                                 .ToAsyncEnumerable().Count()
                                 ) > 0
                                )
                           ).WithMessage("Name already exits");
            });
        }
 public Handler(IApplicationDBContext context, IMediator mediator)
 {
     _context  = context;
     _mediator = mediator;
 }
Exemplo n.º 10
0
 public GetAllBuildingsQueryHandler(IApplicationDBContext context)
 {
     _context = context;
 }
Exemplo n.º 11
0
 public CreateTeamHandler(IApplicationDBContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
 public CreatePartCommandHandler(IApplicationDBContext context)
 {
     _context = context;
 }
Exemplo n.º 13
0
 public GetCarsListQueryHandler(IApplicationDBContext context)
 {
     _context = context;
 }
Exemplo n.º 14
0
 public UpdateNoteCommandHandler(IApplicationDBContext context)
 {
     _context = context;
 }
Exemplo n.º 15
0
 /// <summary>
 /// GetSurveyListQueryHandler
 /// </summary>
 /// <param name="context">Application db context</param>
 /// <param name="mapper">mapper</param>
 /// <param name="getUserInformation">get user information</param>
 public GetSurveyListQueryHandler(IApplicationDBContext context, IMapper mapper, IGetUserInformation getUserInformation)
 {
     _context            = context;
     _mapper             = mapper;
     _getUserInformation = getUserInformation;
 }
 public BaseContext(IApplicationDBContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
Exemplo n.º 17
0
 public TodosRequestHandler(IApplicationDBContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
Exemplo n.º 18
0
 public GetSurveyDetailQueryHandlerTests(QueryTestFixture fixture)
 {
     _context = fixture.Context;
 }
Exemplo n.º 19
0
 public GetPartByIdQueryHandler(IApplicationDBContext context)
 {
     _context = context;
 }
 public GetAllNotesQueryHandler(IApplicationDBContext context)
 {
     _context = context;
 }
Exemplo n.º 21
0
 public DeleteSurveyCommandHandler(IApplicationDBContext context, IGetUserInformation getUserInformation)
 {
     _context            = context;
     _getUserInformation = getUserInformation;
 }
 public GetSurveyDetailQueryHandler(IApplicationDBContext context, IGetUserInformation getUserInformation)
 {
     _context            = context;
     _getUserInformation = getUserInformation;
 }
Exemplo n.º 23
0
 public CustomerController(IApplicationDBContext context)
 {
     _context = context;
 }
Exemplo n.º 24
0
 public AttachStudentToTeamHandler(IApplicationDBContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
Exemplo n.º 25
0
 public GetAllStudentsHandler(IApplicationDBContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
 /// <summary>
 /// Constructor of GetSurveyDetailQueryHandler
 /// </summary>
 /// <param name="context">Application db context</param>
 public GetSurveyDetailQueryHandler(IApplicationDBContext context)
 {
     _context = context;
 }
 public Handler(IApplicationDBContext context, IMediator mediator, IGetUserInformation getUserInformation)
 {
     _context            = context;
     _mediator           = mediator;
     _getUserInformation = getUserInformation;
 }
 public CreateBuildingCommandHandler(IApplicationDBContext context)
 {
     _context = context;
 }
 public CreateItemRequestHandler(IApplicationDBContext dbContext, IMapper mapper) : base(dbContext, mapper)
 {
 }
Exemplo n.º 30
0
 public SampleEntityService(IApplicationDBContext dbContext)
 {
     _dbContext = dbContext;
 }