public void TestKrbErrorRoundtrip()
        {
            var err = new KrbError
            {
                CName = new KrbPrincipalName {
                    Name = new[] { "krbtgt", "domain.com" }, Type = PrincipalNameType.NT_SRV_HST
                },
                CRealm    = "domain.com",
                CTime     = DateTimeOffset.UtcNow,
                Cusec     = 123,
                EData     = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 },
                ErrorCode = KerberosErrorCode.KRB_ERR_GENERIC,
                EText     = "this is a test of the error roundtrip",
                Realm     = "domain.com",
                SName     = new KrbPrincipalName {
                    Name = new[] { "krbtgt", "domain.com" }, Type = PrincipalNameType.NT_SRV_HST
                },
                STime = DateTimeOffset.UtcNow,
                Susc  = 2345356
            };

            var encoded = err.Encode();

            var decoded = KrbError.DecodeApplication(encoded.AsMemory());

            Assert.IsNotNull(decoded);

            Assert.AreEqual(err.CRealm, decoded.CRealm);
            Assert.AreEqual(MessageType.KRB_ERROR, decoded.MessageType);
            Assert.AreEqual(5, decoded.ProtocolVersionNumber);

            Assert.AreEqual(err.CTime.ToString(), decoded.CTime.ToString());
            Assert.AreEqual(err.ErrorCode, decoded.ErrorCode);
            Assert.AreEqual(err.Realm, decoded.Realm);
        }