internal void ToNative(PinCollection pin, out NativeTypes.FABRIC_REPLICA_INFORMATION native) { native.Id = this.Id; native.Role = (NativeTypes.FABRIC_REPLICA_ROLE) this.Role; native.Status = (NativeTypes.FABRIC_REPLICA_STATUS) this.Status; native.ReplicatorAddress = pin.AddBlittable(this.ReplicatorAddress); native.CatchUpCapability = this.CatchUpCapability; native.CurrentProgress = this.CurrentProgress; var ex1 = new NativeTypes.FABRIC_REPLICA_INFORMATION_EX1[1]; ex1[0].MustCatchup = NativeTypes.ToBOOLEAN(this.MustCatchup); ex1[0].Reserved = IntPtr.Zero; native.Reserved = pin.AddBlittable(ex1); }
private static void AssertAreEqual(NativeTypes.FABRIC_REPLICA_INFORMATION native, ReplicaInformation managed) { Assert.AreEqual(native.CatchUpCapability, managed.CatchUpCapability); Assert.AreEqual(native.CurrentProgress, managed.CurrentProgress); Assert.AreEqual(native.Id, managed.Id); Assert.AreEqual(NativeTypes.FromNativeString(native.ReplicatorAddress), managed.ReplicatorAddress); Assert.AreEqual((int)native.Role, (int)managed.Role); Assert.AreEqual((int)native.Status, (int)managed.Status); unsafe { var casted = GetEx1(native); Assert.AreEqual(NativeTypes.FromBOOLEAN(casted->MustCatchup), managed.MustCatchup); Assert.AreEqual(IntPtr.Zero, casted->Reserved); } }
private static void AssertAreEqual(NativeTypes.FABRIC_REPLICA_INFORMATION first, NativeTypes.FABRIC_REPLICA_INFORMATION second) { Assert.AreEqual(first.CatchUpCapability, second.CatchUpCapability); Assert.AreEqual(first.CurrentProgress, second.CurrentProgress); Assert.AreEqual(first.Id, second.Id); Assert.AreEqual(NativeTypes.FromNativeString(first.ReplicatorAddress), NativeTypes.FromNativeString(second.ReplicatorAddress)); Assert.AreEqual(first.Role, second.Role); Assert.AreEqual(first.Status, second.Status); unsafe { var firstEx1 = GetEx1(first); var secondEx1 = GetEx1(second); Assert.AreEqual(firstEx1->Reserved, secondEx1->Reserved); Assert.AreEqual(firstEx1->MustCatchup, secondEx1->MustCatchup); } }
internal unsafe void ToNative(PinCollection pin, out NativeTypes.FABRIC_REPLICA_SET_CONFIGURATION native) { var replicasLength = this.Replicas.Count; native.ReplicaCount = (uint)replicasLength; native.WriteQuorum = (uint)this.WriteQuorum; unsafe { var nativeReplicas = new NativeTypes.FABRIC_REPLICA_INFORMATION[replicasLength]; for (int i = 0; i < replicasLength; i++) { this.Replicas[i].ToNative(pin, out nativeReplicas[i]); } native.Replicas = (IntPtr)pin.AddBlittable(nativeReplicas); } native.Reserved = IntPtr.Zero; }
private static NativeTypes.FABRIC_REPLICA_INFORMATION Validate(PinCollection pin, NativeTypes.FABRIC_REPLICA_INFORMATION native) { var managed = ReplicaInformation.FromNative(pin.AddBlittable(native)); AssertAreEqual(native, managed); NativeTypes.FABRIC_REPLICA_INFORMATION converted; managed.ToNative(pin, out converted); AssertAreEqual(native, converted); return(native); }
private static unsafe NativeTypes.FABRIC_REPLICA_INFORMATION_EX1 *GetEx1(NativeTypes.FABRIC_REPLICA_INFORMATION native) { Assert.AreNotEqual(IntPtr.Zero, native.Reserved); return((NativeTypes.FABRIC_REPLICA_INFORMATION_EX1 *)(native.Reserved)); }