public void AddTest_ExceptionOnExistingJob(string initialStatePath)
        {
            // Arrange
            var initialYamlString = File.ReadAllText(ArtifactDirectory + initialStatePath);
            var changeTracker     = new PrometheusConfigChangeTracker(initialYamlString);

            // Act & Assert
            Assert.That(() => changeTracker.Add(DefaultNodeInfo), Throws.TypeOf <InvalidOperationException>());
            Assert.IsFalse(changeTracker.NeedsUpdate);
        }
        public void InitialBehaviorTest(string initialStatePath, string expectedStatePath, bool expectNeedsUpdate)
        {
            // Arrange
            var initialYamlString  = File.ReadAllText(ArtifactDirectory + initialStatePath);
            var expectedYamlString = File.ReadAllText(ArtifactDirectory + expectedStatePath);
            var changeTracker      = new PrometheusConfigChangeTracker(initialYamlString);

            // Act
            var actualNeedsUpdate = changeTracker.NeedsUpdate;
            var actualYamlString  = changeTracker.ToString();

            // Assert
            Assert.AreEqual(expectNeedsUpdate, actualNeedsUpdate);
            Assert.AreEqual(expectedYamlString, actualYamlString);
        }
        public void AddTest(string initialStatePath, string expectedStatePath)
        {
            // Arrange
            var initialYamlString  = File.ReadAllText(ArtifactDirectory + initialStatePath);
            var expectedYamlString = File.ReadAllText(ArtifactDirectory + expectedStatePath);
            var changeTracker      = new PrometheusConfigChangeTracker(initialYamlString);

            // Act
            changeTracker.Add(DefaultNodeInfo);
            var actualNeedsUpdate = changeTracker.NeedsUpdate;
            var actualYamlString  = changeTracker.ToString();

            // Assert
            Assert.IsTrue(actualNeedsUpdate);
            Assert.AreEqual(expectedYamlString, actualYamlString);
        }
        public void ListTest(string initialStatePath, bool expectDefaultNode)
        {
            // Arrange
            var initialYamlString = File.ReadAllText(ArtifactDirectory + initialStatePath);
            var changeTracker     = new PrometheusConfigChangeTracker(initialYamlString);

            // Act
            var result            = changeTracker.List();
            var actualNeedsUpdate = changeTracker.NeedsUpdate;

            // Assert
            Assert.IsFalse(actualNeedsUpdate);
            if (expectDefaultNode)
            {
                Assert.AreEqual(1, result.Count);
                Assert.AreEqual(DefaultNodeInfo, result[0]);
            }
            else
            {
                Assert.AreEqual(0, result.Count);
            }
        }