public Simulator(ExperimentalConfiguration myExperimentalConfiguration, BlockingAlgorithmOptions options = default(BlockingAlgorithmOptions)) { MyExperimentalConfiguration = myExperimentalConfiguration; if (options == null) options = new BlockingAlgorithmOptions(); CreditLimits = new[] { // 3 per hour new LimitPerTimePeriod(new TimeSpan(1, 0, 0), 3f), // 6 per day (24 hours, not calendar day) new LimitPerTimePeriod(new TimeSpan(1, 0, 0, 0), 6f), // 10 per week new LimitPerTimePeriod(new TimeSpan(6, 0, 0, 0), 10f), // 15 per month new LimitPerTimePeriod(new TimeSpan(30, 0, 0, 0), 15f) }; //We are testing with local server now MyResponsibleHosts = new MaxWeightHashing<RemoteHost>("FIXME-uniquekeyfromconfig"); //configuration.MyResponsibleHosts.Add("localhost", new RemoteHost { Uri = new Uri("http://localhost:80"), IsLocalHost = true }); RemoteHost localHost = new RemoteHost { Uri = new Uri("http://localhost:80") }; MyResponsibleHosts.Add("localhost", localHost); MyUserAccountClient = new UserAccountClient(MyResponsibleHosts, localHost); MyLoginAttemptClient = new LoginAttemptClient(MyResponsibleHosts, localHost); MemoryUsageLimiter memoryUsageLimiter = new MemoryUsageLimiter(); MyUserAccountController = new UserAccountController(MyUserAccountClient, MyLoginAttemptClient, memoryUsageLimiter, options, StableStore, CreditLimits); MyLoginAttemptController = new LoginAttemptController(MyLoginAttemptClient, MyUserAccountClient, memoryUsageLimiter, options, StableStore); MyUserAccountController.SetLoginAttemptClient(MyLoginAttemptClient); MyUserAccountClient.SetLocalUserAccountController(MyUserAccountController); MyLoginAttemptController.SetUserAccountClient(MyUserAccountClient); MyLoginAttemptClient.SetLocalLoginAttemptController(MyLoginAttemptController); //fix outofmemory bug by setting the loginattempt field to null StableStore.LoginAttempts = null; }
public void SetLocalUserAccountController(UserAccountController userAccountController) { _localUserAccountController = userAccountController; }