Microsoft.Protocols.TestSuites.SharedAdapter.SignatureObject.Equals C# (CSharp) Method

Equals() public method

Override the equals method.
public Equals ( object obj ) : bool
obj object Specify the compared instance.
return bool
        public override bool Equals(object obj)
        {
            SignatureObject so = obj as SignatureObject;

            if (so == null)
            {
                return false;
            }

            if (so.SignatureData != null && this.SignatureData != null)
            {
                return so.SignatureData.Equals(this.SignatureData);
            }
            else if (so.SignatureData == null && this.SignatureData == null)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

Usage Example

Example #1
0
        /// <summary>
        /// This method is used to analyze the chunk for simple chunk.
        /// </summary>
        /// <param name="rootNode">Specify the root node object which is needed to be analyzed.</param>
        /// <param name="site">Specify the ITestSite instance.</param>
        public override void AnalyzeChunking(IntermediateNodeObject rootNode, ITestSite site)
        {
            if (rootNode.DataSize.DataSize <= 1024 * 1024)
            {
                // These would be something ignored for MOSS2010, when the file size is less than 1MB.
                // In this case the server will response data without signature, but to be consistent with the behavior,
                // The Simple chunk still will be used, but empty signature check will be ignored.
                return;
            }
            else if (rootNode.DataSize.DataSize <= 250 * 1024 * 1024)
            {
                foreach (LeafNodeObject interNode in rootNode.IntermediateNodeObjectList)
                {
                    SignatureObject expect    = this.GetSignature(interNode.DataNodeObjectData.ObjectData);
                    SignatureObject realValue = interNode.Signature;
                    if (!expect.Equals(interNode.Signature))
                    {
                        site.Assert.Fail("Expect the signature value {0}, but actual value is {1}", expect.ToString(), realValue.ToString());
                    }

                    site.Assert.IsTrue(interNode.DataSize.DataSize <= 1024 * 1024, "The size of each chunk should be equal or less than 1MB for simple chunk.");

                    site.Assert.AreEqual <ulong>(
                        (ulong)interNode.GetContent().Count,
                        interNode.DataSize.DataSize,
                        "Expect the data size value equal the number represented by the chunk.");

                    site.Assert.IsNotNull(
                        interNode.DataNodeObjectData,
                        "The Object References array of the Intermediate Node Object associated with this Data Node Object MUST have a single entry which MUST be the Object ID of the Data Node Object.");
                }

                site.Log.Add(LogEntryKind.Debug, "All the intermediate signature value matches.");

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    MsfsshttpdCapture.VerifySimpleChunk(SharedContext.Current.Site);
                }
            }
            else
            {
                throw new NotImplementedException("When the file size is larger than 250MB, because the signature method is not implemented, the analysis method is also not implemented.");
            }
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.SharedAdapter.SignatureObject::Equals