예제 #1
0
 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));
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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));
        }
예제 #5
0
        public void StatefulPartition_Creation_ReplicatorSettings_NullResultsInNoObject()
        {
            var rv = StatefulPartitionTest.ReplicatorCreationHelper(null);

            Assert.IsFalse(rv.Item1.ReplicatorSettings.HasValue);
        }