public void TestEquality(DeploymentConfigInfo configInfo1, DeploymentConfigInfo configInfo2, bool areEqual) { // Act bool result = configInfo1.Equals(configInfo2); // Assert Assert.Equal(areEqual, result); }
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); } } } }
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); } }