コード例 #1
0
        public override void ClearInfo()
        {
            PartitionSelector ps  = this.Info.PartitionSelector;
            DataLossMode      dlm = this.Info.DataLossMode;

            this.Info = new InvokeDataLossInfo(ps, dlm);
        }
コード例 #2
0
        // test only
        internal bool VerifyEquals(InvokeDataLossInfo other)
        {
            TestabilityTrace.TraceSource.WriteInfo(TraceType, "Enter VerifyEquals in InvokeDataLossInfo");
            bool eq = this.PartitionSelector.Equals(other.PartitionSelector);

            if (!eq)
            {
                TestabilityTrace.TraceSource.WriteError(TraceType, "PartitionSelector does not match this:{0} other:{1}", this.PartitionSelector.ToString(), other.PartitionSelector.ToString());
            }

            eq = this.DataLossMode.Equals(other.DataLossMode) &&
                 this.DataLossNumber.Equals(other.DataLossNumber) &&
                 this.NodeName.Equals(other.NodeName) &&
                 (this.PartitionId == other.PartitionId);
            if (!eq)
            {
                TestabilityTrace.TraceSource.WriteError(TraceType, "DataLossMode/Number, NodeName, or PartitionId do not match");
                return(false);
            }

            if (this.UnreliableTransportInfo.Count != other.UnreliableTransportInfo.Count)
            {
                TestabilityTrace.TraceSource.WriteError(TraceType, "Size of UnreliableTransportInfo does not match {0} vs {1}", this.UnreliableTransportInfo.Count, other.UnreliableTransportInfo.Count);
                return(false);
            }

            for (int i = 0; i < this.UnreliableTransportInfo.Count; i++)
            {
                if ((this.UnreliableTransportInfo[i].Item1 != other.UnreliableTransportInfo[i].Item1) &&
                    (this.UnreliableTransportInfo[i].Item2 != other.UnreliableTransportInfo[i].Item2))
                {
                    TestabilityTrace.TraceSource.WriteError(TraceType, "UT behavior was expected to match: '{0}', '{1}'", this.UnreliableTransportInfo[i], other.UnreliableTransportInfo[i]);
                    return(false);
                }
            }

            return(true);
        }