public void TestApplyingUpdate() { UrlDir.UrlConfig original = UrlBuilder.CreateConfig("abc/def", new ConfigNode("SOME_NODE")); UrlDir.UrlConfig patch1 = UrlBuilder.CreateConfig("ghi/jkl", new ConfigNode("@SOME_NODE")); UrlDir.UrlConfig patch2 = UrlBuilder.CreateConfig("pqr/stu", new ConfigNode("@SOME_NODE")); Assert.Equal(0, progress.Counter.patchedNodes); progress.ApplyingUpdate(original, patch1); Assert.Equal(1, progress.Counter.patchedNodes); logger.Received().Log(LogType.Log, "Applying update ghi/jkl/@SOME_NODE to abc/def/SOME_NODE"); progress.ApplyingUpdate(original, patch2); Assert.Equal(2, progress.Counter.patchedNodes); logger.Received().Log(LogType.Log, "Applying update pqr/stu/@SOME_NODE to abc/def/SOME_NODE"); }
public void TestApplyingUpdate() { IProtoUrlConfig original = Substitute.For <IProtoUrlConfig>(); original.FullUrl.Returns("abc/def.cfg/SOME_NODE"); UrlDir.UrlConfig patch1 = UrlBuilder.CreateConfig("ghi/jkl", new ConfigNode("@SOME_NODE")); UrlDir.UrlConfig patch2 = UrlBuilder.CreateConfig("pqr/stu", new ConfigNode("@SOME_NODE")); Assert.Equal(0, progress.Counter.patchedNodes); progress.ApplyingUpdate(original, patch1); Assert.Equal(1, progress.Counter.patchedNodes); logger.Received().Log(LogType.Log, "Applying update ghi/jkl/@SOME_NODE to abc/def.cfg/SOME_NODE"); progress.ApplyingUpdate(original, patch2); Assert.Equal(2, progress.Counter.patchedNodes); logger.Received().Log(LogType.Log, "Applying update pqr/stu/@SOME_NODE to abc/def.cfg/SOME_NODE"); }
public void Test__Constructor__Nested() { IBasicLogger logger2 = Substitute.For <IBasicLogger>(); PatchProgress progress2 = new PatchProgress(progress, logger2); Assert.Same(progress.Counter, progress2.Counter); Assert.Equal(0, progress.Counter.patchedNodes); UrlDir.UrlConfig original = UrlBuilder.CreateConfig("abc/def", new ConfigNode("SOME_NODE")); UrlDir.UrlConfig patch1 = UrlBuilder.CreateConfig("ghi/jkl", new ConfigNode("@SOME_NODE")); progress2.ApplyingUpdate(original, patch1); Assert.Equal(1, progress.Counter.patchedNodes); logger.DidNotReceiveWithAnyArgs().Log(LogType.Log, null); logger2.Received().Log(LogType.Log, "Applying update ghi/jkl/@SOME_NODE to abc/def/SOME_NODE"); }
public void Test__Constructor__Nested() { IBasicLogger logger2 = Substitute.For <IBasicLogger>(); PatchProgress progress2 = new PatchProgress(progress, logger2); Assert.Same(progress.Counter, progress2.Counter); Assert.Equal(0, progress.Counter.patchedNodes); IProtoUrlConfig original = Substitute.For <IProtoUrlConfig>(); original.FullUrl.Returns("abc/def.cfg/SOME_NODE"); UrlDir.UrlConfig patch1 = UrlBuilder.CreateConfig("ghi/jkl", new ConfigNode("@SOME_NODE")); progress2.ApplyingUpdate(original, patch1); Assert.Equal(1, progress.Counter.patchedNodes); logger.AssertNoLog(); logger2.AssertInfo("Applying update ghi/jkl/@SOME_NODE to abc/def.cfg/SOME_NODE"); }