public async void DeserializeFaillureReturnsEmptyConfig()
        {
            ISerde<DeploymentConfigInfo> serde = this.GetSerde();

            var secretData = new Dictionary<string, byte[]>
            {
                ["backup.json"] = System.Text.Encoding.UTF8.GetBytes("{}")
            };
            var secret = new V1Secret(data: secretData);
            var response = new HttpOperationResponse<V1Secret>()
            {
                Body = secret,
                Response = new HttpResponseMessage(HttpStatusCode.OK)
            };

            var client = new Mock<IKubernetes>(MockBehavior.Strict);
            client.Setup(c => c.ReadNamespacedSecretWithHttpMessagesAsync(
                    DefaultSecretName,
                    DefaultNamespace,
                    It.IsAny<string>(), // pretty
                    null, // customHeaders
                    It.IsAny<CancellationToken>()))
                .ReturnsAsync(response);

            var backupSource = new DeploymentSecretBackup(DefaultSecretName, DefaultNamespace, DefaultOwner, serde, client.Object);
            var deploymentConfigInfo = await backupSource.ReadFromBackupAsync();

            Assert.NotNull(deploymentConfigInfo);
            Assert.Equal(DeploymentConfigInfo.Empty, deploymentConfigInfo);
            client.VerifyAll();
        }
        public async void ReadDeploymentConfigFromSecret()
        {
            ISerde <DeploymentConfigInfo> serde = this.GetSerde();

            var secretData = new Dictionary <string, byte[]>
            {
                ["backup.json"] = System.Text.Encoding.UTF8.GetBytes(serde.Serialize(ValidConfigInfo1))
            };
            var secret   = new V1Secret(data: secretData);
            var response = new HttpOperationResponse <V1Secret>()
            {
                Body     = secret,
                Response = new HttpResponseMessage(HttpStatusCode.OK)
            };

            var client = new Mock <IKubernetes>(MockBehavior.Strict);

            client.Setup(c => c.ReadNamespacedSecretWithHttpMessagesAsync(DefaultSecretName, DefaultNamespace, It.IsAny <bool?>(), It.IsAny <bool?>(), null, null, It.IsAny <CancellationToken>()))
            .ReturnsAsync(response);

            var backupSource         = new DeploymentSecretBackup(DefaultSecretName, DefaultNamespace, DefaultOwner, serde, client.Object);
            var deploymentConfigInfo = await backupSource.ReadFromBackupAsync();

            string returnedJson = serde.Serialize(deploymentConfigInfo);
            string expectedJson = serde.Serialize(ValidConfigInfo1);

            Assert.Equal(expectedJson, returnedJson, ignoreCase: true);
            client.VerifyAll();
        }
        public async void NullSecretreturnsEmptyConfig()
        {
            ISerde<DeploymentConfigInfo> serde = this.GetSerde();

            var response = new HttpOperationResponse<V1Secret>()
            {
                Body = null,
                Response = new HttpResponseMessage(HttpStatusCode.OK)
            };

            var client = new Mock<IKubernetes>(MockBehavior.Strict);
            client.Setup(c => c.ReadNamespacedSecretWithHttpMessagesAsync(
                    DefaultSecretName,
                    DefaultNamespace,
                    It.IsAny<string>(), // pretty
                    null, // customHeaders
                    It.IsAny<CancellationToken>()))
                .ReturnsAsync(response);

            var backupSource = new DeploymentSecretBackup(DefaultSecretName, DefaultNamespace, DefaultOwner, serde, client.Object);
            var deploymentConfigInfo = await backupSource.ReadFromBackupAsync();

            Assert.NotNull(deploymentConfigInfo);
            Assert.Equal(DeploymentConfigInfo.Empty, deploymentConfigInfo);
            client.VerifyAll();
        }