public void TryUpdateEnvironmentParentAsync_should_return_true_and_set_new_parent_for_existent_environment() { const string oldParent = "root"; CreateEnvironmentNode("environment", oldParent, GetProperties()); var serviceDiscoveryManager = new ServiceDiscoveryManager(GetZooKeeperClient(), log: Log); serviceDiscoveryManager.GetEnvironmentAsync("environment") .GetAwaiter() .GetResult() .ParentEnvironment .Should() .BeEquivalentTo(oldParent); const string newParent = "newWorldRoot"; serviceDiscoveryManager.TryUpdateEnvironmentParentAsync("environment", newParent) .GetAwaiter() .GetResult() .Should() .BeTrue(); serviceDiscoveryManager.GetEnvironmentAsync("environment") .GetAwaiter() .GetResult() .ParentEnvironment .Should() .BeEquivalentTo(newParent); }
public void TryUpdateEnvironmentParentAsync_should_return_false_if_environment_does_not_exist() { var serviceDiscoveryManager = new ServiceDiscoveryManager(GetZooKeeperClient(), log: Log); const string newParent = "newWorldRoot"; serviceDiscoveryManager.TryUpdateEnvironmentParentAsync("environment", newParent) .GetAwaiter() .GetResult() .Should() .BeFalse(); serviceDiscoveryManager.GetEnvironmentAsync("environment") .GetAwaiter() .GetResult() .Should() .BeNull(); }