/// <summary> /// Configure the given container with the /// registrations provided by the service. /// </summary> /// <param name="container">Container to register.</param> public override void Configure(Container container) { this.SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" }); // Access Web.Config AppSettings var appSettings = new AppSettings(); container.Register(appSettings); AppConfig = new AppConfig(appSettings); // Add all the Auth Providers to allow registration with this.ConfigureAuth(); // register REST-ful urls this.ConfigureRoutes(); // register Response Filters this.ConfigureResponseFilters(); // Adds caching container.Register<ICacheClient>(new MemoryCacheClient()); // Adds persistent user repository var userRep = new InMemoryAuthRepository(); container.Register<IUserAuthRepository>(userRep); }
public void Test1() { var moq = new Moq.Mock<IResourceManager>(); moq.Setup(x => x.GetList("AdminEmailAddresses")).Returns(new List<string> { "*****@*****.**", " [email protected] " }); var appConfig = new AppConfig(moq.Object); Assert.AreEqual(2, appConfig.AdminEmailAddresses.Count); Assert.AreEqual("*****@*****.**", appConfig.AdminEmailAddresses[0]); Assert.AreEqual("*****@*****.**", appConfig.AdminEmailAddresses[1]); Assert.IsTrue(appConfig.IsAdminUser("*****@*****.**")); Assert.IsTrue(appConfig.IsAdminUser(" [email protected] ")); Assert.IsTrue(appConfig.IsAdminUser("*****@*****.**")); Assert.IsTrue(appConfig.IsAdminUser(" [email protected] ")); Assert.IsFalse(appConfig.IsAdminUser("[email protected] ")); Assert.IsFalse(appConfig.IsAdminUser(null)); }