SlinqyAgentTests() { // Configures one read/writable shard since that's the minimum valid state. this.fakeShard = this.CreateFakeSendReceiveQueue(); // Configures the fake shard monitor to use the fake shards. this.fakeQueueShardMonitor = A.Fake <SlinqyQueueShardMonitor>(); this.fakeShards = new List <SlinqyQueueShard> { this.fakeShard }; // Configures the fake agent queue to use. this.fakeAgentQueue = CreateFakeAgentQueue(); A.CallTo(() => this.fakeQueueService.CreateQueue(ValidSlinqyAgentName)).Returns(this.fakeAgentQueue); A.CallTo(() => this.fakeAgentQueue.OnReceive(A <Func <EvaluateShardsCommand, Task> > .Ignored)).Invokes(call => { this.agentEvaluateShardsCommandHandler = call.GetArgument <Func <EvaluateShardsCommand, Task> >(0); }); A.CallTo(() => this.fakeQueueShardMonitor.SendShard).Returns(this.fakeShard); A.CallTo(() => this.fakeQueueShardMonitor.QueueName).Returns(ValidSlinqyQueueName); A.CallTo(() => this.fakeQueueShardMonitor.Shards).Returns(this.fakeShards); // Configure the agent that will be tested. this.slinqyAgent = new SlinqyAgent( queueService: this.fakeQueueService, slinqyQueueShardMonitor: this.fakeQueueShardMonitor, storageCapacityScaleOutThreshold: ValidStorageCapacityScaleOutThreshold ); }
SlinqyQueueShardMonitorTests() { this.monitor = new SlinqyQueueShardMonitor( ValidSlinqyQueueName, this.fakeQueueService ); }
SlinqyQueueShardMonitorTests() { A.CallTo(() => this.fakeQueueService.ListQueues(ValidSlinqyQueueName) ).Returns(this.fakeQueueServicePhysicalQueues); this.monitor = new SlinqyQueueShardMonitor( ValidSlinqyQueueName, this.fakeQueueService ); }
CreateQueue( CreateQueueCommandModel createQueueModel) { if (createQueueModel == null) { throw new ArgumentNullException(nameof(createQueueModel)); } if (!this.ModelState.IsValid) { return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState)); } var monitor = new SlinqyQueueShardMonitor( createQueueModel.QueueName, PhysicalQueueService ); slinqyAgent = new SlinqyAgent( PhysicalQueueService, monitor, createQueueModel.StorageCapacityScaleOutThresholdPercentage / 100D, 4 ); await slinqyAgent.Start(); SlinqyQueues.Add( createQueueModel.QueueName, new SlinqyQueue(monitor) ); var response = new HttpResponseMessage(HttpStatusCode.Created) { Content = new ObjectContent <QueueInformationViewModel>( new QueueInformationViewModel( queueName: createQueueModel.QueueName, maxQueueSizeMegabytes: createQueueModel.MaxQueueSizeMegabytes, currentQueueSizeBytes: 0 ), new JsonMediaTypeFormatter() ) }; return(response); }
SlinqyAgentTests() { // Configures one read/writable shard since that's the minimum valid state. this.fakeShard = this.CreateFakeSendReceiveQueue(); // Configures the fake shard monitor to use the fake shards. this.fakeQueueShardMonitor = A.Fake<SlinqyQueueShardMonitor>(); this.fakeShards = new List<SlinqyQueueShard> { this.fakeShard }; A.CallTo(() => this.fakeQueueShardMonitor.SendShard).Returns(this.fakeShard); A.CallTo(() => this.fakeQueueShardMonitor.QueueName).Returns(ValidSlinqyQueueName); A.CallTo(() => this.fakeQueueShardMonitor.Shards).Returns(this.fakeShards); // Configure the agent that will be tested. this.slinqyAgent = new SlinqyAgent( queueService: this.fakeQueueService, slinqyQueueShardMonitor: this.fakeQueueShardMonitor, storageCapacityScaleOutThreshold: ValidStorageCapacityScaleOutThreshold ); }
SlinqyAgentTests() { // Configures one read/writable shard since that's the minimum valid state. this.fakeShard = this.CreateFakeSendReceiveQueue(); // Configures the fake shard monitor to use the fake shards. this.fakeQueueShardMonitor = A.Fake<SlinqyQueueShardMonitor>(); this.fakeShards = new List<SlinqyQueueShard> { this.fakeShard }; // Configures the fake agent queue to use. this.fakeAgentQueue = CreateFakeAgentQueue(); A.CallTo(() => this.fakeQueueService.CreateQueue(ValidSlinqyAgentName)).Returns(this.fakeAgentQueue); A.CallTo(() => this.fakeAgentQueue.OnReceive(A<Func<EvaluateShardsCommand, Task>>.Ignored)).Invokes(call => { this.agentEvaluateShardsCommandHandler = call.GetArgument<Func<EvaluateShardsCommand, Task>>(0); }); A.CallTo(() => this.fakeQueueShardMonitor.SendShard).Returns(this.fakeShard); A.CallTo(() => this.fakeQueueShardMonitor.QueueName).Returns(ValidSlinqyQueueName); A.CallTo(() => this.fakeQueueShardMonitor.Shards).Returns(this.fakeShards); // Configure the agent that will be tested. this.slinqyAgent = new SlinqyAgent( queueService: this.fakeQueueService, slinqyQueueShardMonitor: this.fakeQueueShardMonitor, storageCapacityScaleOutThreshold: ValidStorageCapacityScaleOutThreshold ); }