public ResourceEntry ToResourceEntry(IEncryption encryption, MamChannelFactory channelFactory, MamChannelSubscriptionFactory subscriptionFactory)
        {
            var decryptedChannel      = encryption.Decrypt(this.Channel);
            var decryptedSubscription = encryption.Decrypt(this.Subscription);

            return(new ResourceEntry
            {
                ResourceRoots = this.Roots.Split(';').ToList(),
                Channel = string.IsNullOrEmpty(decryptedChannel) ? null : channelFactory.CreateFromJson(decryptedChannel),
                Subscription = subscriptionFactory.CreateFromJson(decryptedSubscription)
            });
        }
        public void TestSubscriptionCreationAndRecreation()
        {
            var mask = new CurlMask();
            var subscriptionFactory = new MamChannelSubscriptionFactory(new InMemoryIotaRepository(), CurlMamParser.Default, mask);

            var root         = new Hash(Seed.Random().Value);
            var channelKey   = Seed.Random();
            var subscription = subscriptionFactory.Create(root, Mode.Restricted, channelKey.Value, true);

            var serializedSubscription = subscription.ToJson();

            var recreatedSubscription = subscriptionFactory.CreateFromJson(serializedSubscription);

            Assert.AreEqual(root.Value, recreatedSubscription.MessageRoot.Value);
        }