Beispiel #1
0
        public AccountsLoginService(RiverLaneContext context, IAuthenticationProvider authenticationProvider)
        {
            Check.NotNull(context, nameof(context));
            Check.NotNull(authenticationProvider, nameof(authenticationProvider));

            this.context = context;
            this.authenticationProvider = authenticationProvider;
        }
        public SettingsEditService(RiverLaneContext context, IMapper mapper)
        {
            Check.NotNull(context, nameof(context));
            Check.NotNull(mapper, nameof(mapper));

            this.context = context;
            this.mapper  = mapper;
        }
Beispiel #3
0
        public UsersIndexService(RiverLaneContext context, IMapper mapper)
        {
            Check.NotNull(context, nameof(context));
            Check.NotNull(mapper, nameof(mapper));

            this.context = context;
            this.mapper  = mapper;
        }
Beispiel #4
0
        protected override void SetRules(RiverLaneContext context)
        {
            RuleFor(x => x.Username)
            .NotEmpty()
            .Length(1, 50);

            RuleFor(x => x.PasswordDetails)
            .SetValidator(new PasswordModelValidator(context));
        }
Beispiel #5
0
        protected override void SetRules(RiverLaneContext context)
        {
            RuleFor(x => x.Password)
            .Matches(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8}.*$")
            .WithMessage("The password entered does not satisfy the password strength criteria. It must be 8 or more characters long and contain: a lowercase character, an uppercase character and a number.");

            RuleFor(x => x.ConfirmPassword)
            .Equal(x => x.Password)
            .WithMessage("The Password and Confirm Password fields must match.");
        }
        protected DatabaseTest()
        {
            context = new RiverLaneContext();

            var config = new MapperConfiguration(cfg => AutoMapperConfig.Configure(cfg));

            mapper = config.CreateMapper();

            deleter.DeleteAll(Context);
            seeder.Seed(Context);
        }
        protected override void SetRules(RiverLaneContext context)
        {
            RuleFor(x => x.ContactEmail)
            .NotEmpty()
            .Length(1, 200);

            RuleFor(x => x.ContactNumber)
            .NotEmpty()
            .Length(1, 30);

            RuleFor(x => x.Address)
            .SetValidator(new AddressModelValidator(context));
        }
        protected override void SetRules(RiverLaneContext context)
        {
            RuleFor(x => x.HouseName)
            .Must((model, property) => BePresentIfNothingElseIs(model)).WithMessage("You must specify at least one address field")
            .Length(1, 50);

            RuleFor(x => x.Street)
            .Must((model, property) => BePresentIfNothingElseIs(model)).WithMessage("You must specify at least one address field")
            .Length(1, 50);

            RuleFor(x => x.Town)
            .Must((model, property) => BePresentIfNothingElseIs(model)).WithMessage("You must specify at least one address field")
            .Length(1, 50);

            RuleFor(x => x.City)
            .Must((model, property) => BePresentIfNothingElseIs(model)).WithMessage("You must specify at least one address field")
            .Length(1, 50);

            RuleFor(x => x.Postcode)
            .Must((model, property) => BePresentIfNothingElseIs(model)).WithMessage("You must specify at least one address field")
            .Length(1, 10);
        }
 public SettingsEditServiceTests()
 {
     dummyContext = new Mock <RiverLaneContext>().Object;
     dummyMapper  = new Mock <IMapper>().Object;
 }
 /// <summary>
 /// Initialises a new instance of the <see cref="RiverLaneFormsTokenProvider"/> class
 /// </summary>
 /// <param name="context">A connection to the database</param>
 public RiverLaneFormsTokenProvider(RiverLaneContext context)
 {
     Check.NotNull(context, nameof(context));
     this.context = context;
 }
 public AddressModelValidator(RiverLaneContext context) : base(context)
 {
 }
Beispiel #12
0
 public UserCreateService(RiverLaneContext context)
 {
     Check.NotNull(context, nameof(context));
     this.context = context;
 }
Beispiel #13
0
 public AccountsLoginServiceTests()
 {
     dummyContext = new Mock <RiverLaneContext>().Object;
     dummyAuthenticationProvider = new Mock <IAuthenticationProvider>().Object;
 }
Beispiel #14
0
 public PasswordModelValidator(RiverLaneContext context) : base(context)
 {
 }
Beispiel #15
0
 protected abstract void SetRules(RiverLaneContext context);
Beispiel #16
0
 /// <summary>
 /// Initialises a new instance of a <see cref="ViewModelValidator{T}"/> with a <see cref="RiverLaneContext"/> already made
 /// </summary>
 /// <param name="factory"></param>
 protected ViewModelValidator(RiverLaneContext context)
 {
     Check.NotNull(context, nameof(context));
     SetRules(context);
 }
Beispiel #17
0
 /// <summary>
 /// Initialises a new instance of the <see cref="RiverLaneFormsAuthenticationProvider"/> class
 /// </summary>
 /// <param name="context">A connection to the database</param>
 public RiverLaneFormsAuthenticationProvider(RiverLaneContext context)
 {
     Check.NotNull(context, nameof(context));
     this.context = context;
 }
Beispiel #18
0
 public TestableFormsTokenProvider(RiverLaneContext context) : base(context)
 {
 }
 public UsersIndexServiceTests()
 {
     dummyContext = new Mock <RiverLaneContext>().Object;
     dummyMapper  = new Mock <IMapper>().Object;
 }
Beispiel #20
0
 public TestableFormsAuthenticationProvider(RiverLaneContext context) : base(context)
 {
 }