public void CryptoKeyStore_Add()
        {
            var bytes = Guid.NewGuid().ToByteArray();

            byte[] bytesToReturn = null;
            var    key           = Guid.NewGuid().ToString();

            var config = new Mock <IConfigurationProvider>();

            config.Setup(x => x.GetGlobalConfigurationAsString(It.IsAny <string>(), It.IsAny <string>()))
            .Returns("test_bucket");

            var fileStore = new Mock <IFileStore>();

            fileStore.Setup(x => x.Add(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <byte[]>()))
            .Callback <string, string, byte[]>((k, p, v) => bytesToReturn = v);

            fileStore.Setup(x => x.Get(It.IsAny <string>(), It.IsAny <string>())).Returns(() => bytesToReturn);

            var fileStoreFactory = new Mock <IFileStoreFactory>();

            fileStoreFactory.Setup(x => x.GetGlobalClient()).Returns(fileStore.Object);

            var cryptoKeyStore = new CryptoKeyStore(config.Object, fileStoreFactory.Object);

            cryptoKeyStore.Add(_application, _tenant, key, bytes);

            var value = cryptoKeyStore.Get(_application, _tenant, key);

            Assert.NotNull(value);
        }
        public void CryptoKeyStore_Get_NoDataInStore_ShouldReturn_Null()
        {
            var key    = Guid.NewGuid().ToString();
            var config = new Mock <IConfigurationProvider>();

            config.Setup(x => x.GetGlobalConfigurationAsString(It.IsAny <string>(), It.IsAny <string>())).Returns("test_bucket");

            var fileStore = new Mock <IFileStore>();

            fileStore.Setup(x => x.Get(It.IsAny <string>(), It.IsAny <string>())).Returns(() => null);

            var fileStoreFactory = new Mock <IFileStoreFactory>();

            fileStoreFactory.Setup(x => x.GetGlobalClient()).Returns(fileStore.Object);

            var cryptoKeyStore = new CryptoKeyStore(config.Object, fileStoreFactory.Object);

            var value = cryptoKeyStore.Get(_application, _tenant, key);

            Assert.Null(value);
        }