public async void ChangeFileAndSeeChange() { // Set up initial config file and create `FileConfigSource` File.WriteAllText(this.tempFileName, ValidJson1); Diff validDiff1To2 = ValidSet2.Diff(ValidSet1); using (FileConfigSource configSource = await FileConfigSource.Create(this.tempFileName, this.config, this.serde)) { Assert.NotNull(configSource); DeploymentConfigInfo deploymentConfigInfo = await configSource.GetDeploymentConfigInfoAsync(); Assert.NotNull(deploymentConfigInfo); ModuleSet initialModuleSet = deploymentConfigInfo.DeploymentConfig.GetModuleSet(); Diff emptyDiff = ValidSet1.Diff(initialModuleSet); Assert.True(emptyDiff.IsEmpty); // Modify the config file by writing new content. File.WriteAllText(this.tempFileName, ValidJson2); await Task.Delay(TimeSpan.FromSeconds(20)); DeploymentConfigInfo updatedAgentConfig = await configSource.GetDeploymentConfigInfoAsync(); Assert.NotNull(updatedAgentConfig); ModuleSet updatedModuleSet = updatedAgentConfig.DeploymentConfig.GetModuleSet(); Diff newDiff = updatedModuleSet.Diff(initialModuleSet); Assert.False(newDiff.IsEmpty); Assert.Equal(newDiff, validDiff1To2); } }
public async void CreateSuccess() { File.WriteAllText(this.tempFileName, ValidJson1); using (FileConfigSource configSource = await FileConfigSource.Create(this.tempFileName, this.config, this.serde)) { Assert.NotNull(configSource); DeploymentConfigInfo deploymentConfigInfo = await configSource.GetDeploymentConfigInfoAsync(); Assert.NotNull(deploymentConfigInfo); Assert.NotNull(deploymentConfigInfo.DeploymentConfig); ModuleSet moduleSet = deploymentConfigInfo.DeploymentConfig.GetModuleSet(); Diff emptyDiff = ValidSet1.Diff(moduleSet); Assert.True(emptyDiff.IsEmpty); } }