public void shouldCacheUnusedMethodsAtRebuildUsingRebuild() { var testee = new PipelineManager(this.scheme); testee.BuildPipeline(new TestSubject()); var nameOfShort = typeof(short).AssemblyQualifiedName; var nameOfInt = typeof(int).AssemblyQualifiedName; var nameOfTestSubj = typeof(TestSubject).AssemblyQualifiedName; var secondConfig = "{" + nameOfTestSubj + "; Add3; " + nameOfShort + "; " + nameOfShort + "; (0,2)}\n" + "{" + nameOfTestSubj + "; Square; " + nameOfShort + "; " + nameOfInt + "; (0,0)}\n" + "{" + nameOfTestSubj + "; Squareroot; " + nameOfInt + "; " + nameOfShort + "; (0,1)}\n" + "{" + nameOfTestSubj + "; Subtract3; " + nameOfShort + "; " + nameOfShort + "; (0,5)}\n"; var secondScheme = PipelineScheme.Parse(secondConfig); testee.RebuildPipeline(secondScheme, new TestSubject()); var cacheCollection = testee.GetType().GetField("unusedSteps", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); var actualCollection = (Dictionary<StepMetadata, StepWrapper>)cacheCollection.GetValue(testee); Assert.IsTrue(actualCollection.Count > 0, actualCollection.Values.PrintContentsToString('\n')); }
public void shouldRebuildPipeline() { // Setup test object and states. (states are represented by the scheme objects) var rebuildingTestee = new PipelineManager(this.scheme); var nameOfShort = typeof(short).AssemblyQualifiedName; var nameOfInt = typeof(int).AssemblyQualifiedName; var nameOfTestSubj = typeof(TestSubject).AssemblyQualifiedName; var secondConfig = "{" + nameOfTestSubj + "; Add3; " + nameOfShort + "; " + nameOfShort + "; (0,2)}\n" + "{" + nameOfTestSubj + "; Square; " + nameOfShort + "; " + nameOfInt + "; (0,0)}\n" + "{" + nameOfTestSubj + "; Squareroot; " + nameOfInt + "; " + nameOfShort + "; (0,1)}\n" + "{" + nameOfTestSubj + "; Subtract3; " + nameOfShort + "; " + nameOfShort + "; (0,5)}\n"; var secondScheme = PipelineScheme.Parse(secondConfig); var buildResults = rebuildingTestee.BuildPipeline(new TestSubject()); foreach (var entry in buildResults) { Assert.IsTrue(entry.Outcome == StepBuildResults.Completed, "First build did not succeed\n" + buildResults.PrintContentsToString('\n')); } buildResults = rebuildingTestee.RebuildPipeline(secondScheme, new TestSubject()); foreach (var entry in buildResults) { Assert.IsTrue(entry.Outcome == StepBuildResults.Completed, "Second build did not succeed\n" + buildResults.PrintContentsToString('\n')); } }