public void Verify_That_WriteXmlAsync_Without_Definition_Set_Throws_SerializationException()
        {
            using var memoryStream = new MemoryStream();
            using var writer       = XmlWriter.Create(memoryStream, new XmlWriterSettings { Indent = true });
            var attributeValueEnumeration = new AttributeValueEnumeration();

            var cts = new CancellationTokenSource();

            Assert.That(async() => await attributeValueEnumeration.WriteXmlAsync(writer, cts.Token),
                        Throws.Exception.TypeOf <SerializationException>());
        }
        public void Verify_That_WriteXmlAsync_Throws_Exception_when_cancelled()
        {
            using var memoryStream = new MemoryStream();
            using var writer       = XmlWriter.Create(memoryStream, new XmlWriterSettings { Indent = true });

            var attributeValueEnumeration = new AttributeValueEnumeration
            {
                Definition = new AttributeDefinitionEnumeration()
            };

            var cts = new CancellationTokenSource();

            cts.Cancel();

            Assert.That(
                async() => await attributeValueEnumeration.WriteXmlAsync(writer, cts.Token),
                Throws.Exception.TypeOf <OperationCanceledException>());
        }