Example #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Topic.Length != 0)
            {
                hash ^= Topic.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.ClientRegistration)
            {
                hash ^= ClientRegistration.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.DeviceRegistration)
            {
                hash ^= DeviceRegistration.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Subscription)
            {
                hash ^= Subscription.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public void DeviceRegistration_FromJson()
        {
            DeviceRegistration deviceRegistration = DeviceRegistration.FromJson <DeviceRegistration>(JsonData);

            Assert.IsNotNull(deviceRegistration);
            Assert.IsNotNull(deviceRegistration.KeyHandle);
            Assert.IsNotNull(deviceRegistration.PublicKey);
            Assert.IsNotNull(deviceRegistration.GetAttestationCertificate());
            Assert.IsNotNull(deviceRegistration.ToJsonWithOutAttestionCert());
            Assert.IsNotNull(deviceRegistration.ToJson());
            Assert.IsTrue(deviceRegistration.PublicKey.Length > 0);
            Assert.IsTrue(deviceRegistration.KeyHandle.Length > 0);
            Assert.IsTrue(deviceRegistration.GetHashCode() != 0);
        }