Exemplo n.º 1
0
        void CompressThenEncrypt()
        {
            var original = "Top Score is 305";
            var data     = new CompressDecorator((new FileDataSource(original)));

            data.writeData(original);
            var data2 = new EncryptionDecorator(data);

            data2.writeData(data.readData());
            var converted = data2.readData(); // compress then encryppt.

            Assert.Equal("top score is 3", converted);
        }
Exemplo n.º 2
0
        void CompressThenEncodeThenEncrypt()
        {
            var original = "Top Score is 305";
            var data     = new CompressDecorator(new FileDataSource(original));

            data.writeData(original);
            var data2 = new EncodeDecorator(data);

            data2.writeData(data.readData());
            var data3 = new EncryptionDecorator(data2);

            data3.writeData(data2.readData());
            var converted = data3.readData();

            Assert.Equal("(top score is 3)", converted);
        }