public static void WithUsingFuncAndAction()
        {
            var original = Guid.NewGuid().ToString();
            var newValue = Guid.NewGuid().ToString();

            using var writer = new TestWriter();
            writer.Write(original);

            var builder = new StringBuilder();

            using (var stringWriter = new StringWriter(builder))
            {
                using (stringWriter.With(
                           () => writer.Writer, (value) => writer.Writer = value))
                {
                    writer.Write(newValue);
                }
            }

            Assert.Multiple(() =>
            {
                Assert.That(builder.ToString(), Is.EqualTo(newValue), nameof(builder));
                Assert.That(writer.Writer.GetStringBuilder().ToString(), Is.EqualTo(original), nameof(writer));
            });
        }
        public void WithUsingFuncAndAction()
        {
            var generator = new RandomObjectGenerator();
            var original = generator.Generate<string>();
            var newValue = generator.Generate<string>();

            using (var writer = new TestWriter())
            {
                writer.Write(original);

                var builder = new StringBuilder();

                using (new StringWriter(builder).With(
                    () => writer.Writer, (value) => writer.Writer = value))
                {
                    writer.Write(newValue);
                }

                Assert.AreEqual(newValue, builder.ToString());
                Assert.AreEqual(original, writer.Writer.GetStringBuilder().ToString());
            }
        }