コード例 #1
0
        public void TestEquality(DeploymentConfigInfo configInfo1, DeploymentConfigInfo configInfo2, bool areEqual)
        {
            // Act
            bool result = configInfo1.Equals(configInfo2);

            // Assert
            Assert.Equal(areEqual, result);
        }
コード例 #2
0
ファイル: BackupConfigSource.cs プロジェクト: nlcamp/iotedge
        async Task BackupDeploymentConfigAsync(DeploymentConfigInfo deploymentConfigInfo)
        {
            // backup the config info only if there isn't an error in it
            if (!deploymentConfigInfo.Exception.HasValue &&
                !this.lastBackedUpConfig.Filter(c => deploymentConfigInfo.Equals(c)).HasValue)
            {
                using (await this.sync.LockAsync())
                {
                    this.lastBackedUpConfig = Option.Some(deploymentConfigInfo);

                    try
                    {
                        await this.backupSource.BackupDeploymentConfigAsync(deploymentConfigInfo);
                    }
                    catch (Exception e)
                    {
                        Events.SetBackupFailed(e, this.backupSource.Name);
                    }
                }
            }
        }
コード例 #3
0
        async Task BackupDeploymentConfig(DeploymentConfigInfo deploymentConfigInfo)
        {
            try
            {
                // backup the config info only if there isn't an error in it
                if (!deploymentConfigInfo.Exception.HasValue &&
                    !this.lastBackedUpConfig.Filter(c => deploymentConfigInfo.Equals(c)).HasValue)
                {
                    string json      = this.serde.Serialize(deploymentConfigInfo);
                    string encrypted = await this.encryptionProvider.EncryptAsync(json);

                    using (await this.sync.LockAsync())
                    {
                        await DiskFile.WriteAllAsync(this.configFilePath, encrypted);

                        this.lastBackedUpConfig = Option.Some(deploymentConfigInfo);
                    }
                }
            }
            catch (Exception e)
            {
                Events.SetBackupFailed(e, this.configFilePath);
            }
        }