public void SetUp() { request = Request.Get("foo/bar"); replicas = new[] { replica1 = new Uri("http://replica-1"), replica2 = new Uri("http://replica-2"), replica3 = new Uri("http://replica-3"), replica4 = new Uri("http://replica-4"), replica5 = new Uri("http://replica-5") }; modifiers = new List <IReplicaWeightModifier> { Substitute.For <IReplicaWeightModifier>(), Substitute.For <IReplicaWeightModifier>(), Substitute.For <IReplicaWeightModifier>() }; storageProvider = Substitute.For <IReplicaStorageProvider>(); weightCalculator = Substitute.For <IReplicaWeightCalculator>(); // ReSharper disable AssignNullToNotNullAttribute weightCalculator.GetWeight(null, null, null, null).ReturnsForAnyArgs(1.0); // ReSharper restore AssignNullToNotNullAttribute ordering = new WeighedReplicaOrdering(modifiers, weightCalculator); }
internal WeighedReplicaOrdering( [NotNull] IList <IReplicaWeightModifier> modifiers, [NotNull] IReplicaWeightCalculator weightCalculator) { this.modifiers = modifiers; this.weightCalculator = weightCalculator; }
public void TestSetup() { request = Request.Get("foo/bar"); parameters = RequestParameters.Empty; replicas = new[] { replica1 = new Uri("http://replica-1"), replica2 = new Uri("http://replica-2"), replica3 = new Uri("http://replica-3"), replica4 = new Uri("http://replica-4"), replica5 = new Uri("http://replica-5") }; modifiers = new List <IReplicaWeightModifier> { Substitute.For <IReplicaWeightModifier>(), Substitute.For <IReplicaWeightModifier>(), Substitute.For <IReplicaWeightModifier>() }; storageProvider = Substitute.For <IReplicaStorageProvider>(); weightCalculator = Substitute.For <IReplicaWeightCalculator>(); weightCalculator.GetWeight(null, null, null, null, null).ReturnsForAnyArgs(1.0); ordering = new WeighedReplicaOrdering(modifiers, weightCalculator); }