public void FreezableObjectTest()
        {
            var sut = new FreezableObject();

            Assert.False(sut.IsFrozen());
            sut.Freeze();
            Assert.True(sut.IsFrozen());
        }
        public void AsFrozenTest()
        {
            var fo = new FreezableObject();

            Assert.False(fo.IsFrozen());
            FreezableExtensions.ThrowIfFrozen(fo);
            Assert.Same(fo, FreezableExtensions.AsFrozen(fo));
            Assert.True(fo.IsFrozen());
            Assert.Throws <System.InvalidOperationException>(() => FreezableExtensions.ThrowIfFrozen(fo));
            Assert.False(fo.Freeze());
        }
        public void ThrowIfFrozenTest()
        {
            var fo = new FreezableObject();

            Assert.False(fo.IsFrozen());
            FreezableExtensions.ThrowIfFrozen(fo);
            Assert.Throws <System.InvalidOperationException>(() => FreezableExtensions.ThrowIfNotFrozen(fo));
            try {
                FreezableExtensions.ThrowIfNotFrozen(fo);
            } catch (System.Exception error) {
                Assert.Equal("Brimborium.Extensions.Freezable.FreezableObject is NOT frozen.", error.Message);
            }
            try {
                FreezableExtensions.ThrowIfNotFrozen(fo, "xxx");
            } catch (System.Exception error) {
                Assert.Equal("xxx is NOT frozen.", error.Message);
            }


            Assert.True(fo.Freeze());
            Assert.True(fo.IsFrozen());
            Assert.Throws <System.InvalidOperationException>(() => FreezableExtensions.ThrowIfFrozen(fo));
            FreezableExtensions.ThrowIfNotFrozen(fo);
            try {
                FreezableExtensions.ThrowIfFrozen(fo);
            } catch (System.Exception error) {
                Assert.Equal("Brimborium.Extensions.Freezable.FreezableObject is frozen.", error.Message);
            }
            try {
                FreezableExtensions.ThrowIfFrozen(fo, "xxx");
            } catch (System.Exception error) {
                Assert.Equal("xxx is frozen.", error.Message);
            }

            Assert.False(fo.Freeze());
        }