public Instance() { this.NativePartition = new TNativePartition(); this.NativeReplicator = new TNativeReplicator(); this.NativeStateReplicator = new TNativeStateReplicator(); this.Broker = StatefulPartitionTest.CreateDefaultBroker(); this.Partition = new StatefulServicePartition( this.NativePartition, ServicePartitionInformation.FromNative(StatefulPartitionTest.DefaultPartitionInfo)); }
public void StatefulPartition_Creation_ServicePartitionInfoIsCreated() { var rv = StatefulPartitionTest.ReplicatorCreationHelper(); var expected = ServicePartitionInformation.FromNative(StatefulPartitionTest.DefaultPartitionInfo); var actual = rv.Item2.PartitionInfo; Assert.AreEqual <Guid>(expected.Id, actual.Id); Assert.AreEqual(expected.GetType(), actual.GetType()); Assert.AreEqual <Guid>(expected.Id, (Guid)rv.Item2.PartitionInfo.Id); }
private void ReplicatorSettingsTestHelper( ReplicatorSettings valueToPass, NativeTypes.FABRIC_REPLICATOR_SETTINGS_FLAGS flagsExpected, Action <NativeTypes.FABRIC_REPLICATOR_SETTINGS> validator) { var rv = StatefulPartitionTest.ReplicatorCreationHelper(valueToPass); NativeTypes.FABRIC_REPLICATOR_SETTINGS nativeObj = rv.Item1.ReplicatorSettings.Value; Assert.AreEqual <uint>((uint)flagsExpected, rv.Item1.ReplicatorSettings.Value.Flags); validator(nativeObj); }
private static Tuple <StatefulNativePartitionStubForStatefulPartitionCreation, StatefulServicePartition, FabricReplicator> ReplicatorCreationHelper(ReplicatorSettings settings = null) { StatefulServiceReplicaBroker broker = StatefulPartitionTest.CreateDefaultBroker(settings); var nativePartition = new StatefulNativePartitionStubForStatefulPartitionCreation { NativePartitionInfo = StatefulPartitionTest.DefaultPartitionInfo, ReplicatorOut = new ReplicatorStubBase(), StateReplicatorOut = new StateReplicatorStubBase() }; StatefulServicePartition partition = new StatefulServicePartition(nativePartition, ServicePartitionInformation.FromNative(nativePartition.GetPartitionInfo())); var fabricReplicator = partition.CreateReplicator((IStateProvider)broker.Service, settings); return(Tuple.Create(nativePartition, partition, fabricReplicator)); }
public void StatefulPartition_Creation_ReplicatorSettings_NullResultsInNoObject() { var rv = StatefulPartitionTest.ReplicatorCreationHelper(null); Assert.IsFalse(rv.Item1.ReplicatorSettings.HasValue); }