static AliasesControllerTests()
        {
            Mock <IUtcNow> mock = new Mock <IUtcNow>();

            mock.Setup(u => u.UtcNow).Returns(DateTime.Parse("2018-03-12 08:30:52Z"));
            now = mock.Object;
        }
Exemple #2
0
        static EmailQueueProcessorTests()
        {
            Mock <IUtcNow> mock = new Mock <IUtcNow>();

            mock.Setup(u => u.UtcNow).Returns(DateTime.Parse("2018-03-12 08:30:52Z"));
            now = mock.Object;
        }
Exemple #3
0
 public ClientsController(IdentityWsDbContext ef, ILogger <ClientsController> log, IUtcNow now, IConfiguration config)
 {
     this.ef     = ef;
     this.log    = log;
     this.now    = now;
     this.config = config;
 }
 public AliasesController(IdentityWsDbContext ef, ILogger <AliasesController> log, IUtcNow now,
                          IBackgroundJobRunner <EmailQueueProcessor> runner)
 {
     this.ef     = ef;
     this.log    = log;
     this.now    = now;
     this.runner = runner;
 }
 public TableCleaner(IUtcNow now)
 {
     this.now           = now;
     this.entityName    = typeof(T).Name;
     this.tableProperty = typeof(IdentityWsDbContext)
                          .GetProperties()
                          .First(p => p.PropertyType == typeof(DbSet <T>));
 }
        static TableCleanerTests()
        {
            Mock <IUtcNow> mock = new Mock <IUtcNow>();

            mock.Setup(u => u.UtcNow).Returns(DateTime.Parse("2018-03-12 08:30:52Z"));
            now = mock.Object;

            IConfigurationRoot root = new ConfigurationBuilder()
                                      .AddInMemoryCollection(new Dictionary <string, string>
            {
                ["TableCleaner:DeleteCreatedBeforeDays:LoginAttempt"] = "2"
            })
                                      .Build();

            jobSection = root.GetSection("TableCleaner");
        }
Exemple #7
0
        static ClientsControllerTests()
        {
            Mock <IUtcNow> mock = new Mock <IUtcNow>();

            mock.Setup(u => u.UtcNow).Returns(DateTime.Parse("2018-03-12 08:30:52Z"));
            now = mock.Object;

            // "LockoutPeriodMins": 15
            // "MaxFailedLoginsBeforeLockout": 2
            Mock <IConfigurationSection> mock_section1 = new Mock <IConfigurationSection>();

            mock_section1.Setup(m => m.Value).Returns("15");
            Mock <IConfigurationSection> mock_section2 = new Mock <IConfigurationSection>();

            mock_section2.Setup(m => m.Value).Returns("2");
            Mock <IConfiguration> mock_config = new Mock <IConfiguration>();

            mock_config.Setup(m => m.GetSection("LockoutPeriodMins")).Returns(mock_section1.Object);
            mock_config.Setup(m => m.GetSection("MaxFailedLoginsBeforeLockout")).Returns(mock_section2.Object);
            config = mock_config.Object;
        }
 public EmailQueueProcessor(ILogger <EmailQueueProcessor> log, IUtcNow now)
 {
     this.log = log;
     this.now = now;
 }