public void CanBuild_WithComponents_IsTrue() { var pipeline = new TestBuildPipelineWithComponents(); var config = BuildConfiguration.CreateInstance(); Assert.That(pipeline.CanBuild(config).Result, Is.True); }
public void Run_WithComponents_Succeeds() { var pipeline = new TestBuildPipelineWithComponents(); var config = BuildConfiguration.CreateInstance(); Assert.That(pipeline.Build(config).Succeeded, Is.True); Assert.That(pipeline.CanRun(config).Result, Is.True); using (var result = pipeline.Run(config)) { Assert.That(result.Succeeded, Is.True); } }
public void GetComponentOrDefault() { var pipeline = new TestBuildPipelineWithComponents(); var config = BuildConfiguration.CreateInstance(); var context = new TestContextBase(pipeline, config); Assert.That(context.HasComponent <TestBuildComponentA>(), Is.False); Assert.That(context.GetComponentOrDefault <TestBuildComponentA>(), Is.Not.Null); Assert.Throws <InvalidOperationException>(() => context.GetComponentOrDefault <TestBuildComponentC>()); Assert.Throws <ArgumentNullException>(() => context.GetComponentOrDefault(null)); Assert.Throws <InvalidOperationException>(() => context.GetComponentOrDefault(typeof(object))); Assert.Throws <InvalidOperationException>(() => context.GetComponentOrDefault(typeof(TestBuildComponentInvalid))); }
public void TryGetComponent() { var pipeline = new TestBuildPipelineWithComponents(); var config = BuildConfiguration.CreateInstance(c => c.SetComponent <TestBuildComponentA>()); var context = new TestContextBase(pipeline, config); Assert.That(context.TryGetComponent <TestBuildComponentA>(out _), Is.True); Assert.That(context.TryGetComponent <TestBuildComponentB>(out _), Is.False); Assert.Throws <InvalidOperationException>(() => context.TryGetComponent <TestBuildComponentC>(out _)); Assert.Throws <ArgumentNullException>(() => context.TryGetComponent(null, out _)); Assert.Throws <InvalidOperationException>(() => context.TryGetComponent(typeof(object), out _)); Assert.Throws <InvalidOperationException>(() => context.TryGetComponent(typeof(TestBuildComponentInvalid), out _)); }
public void BuildIncremental_WithComponents_Succeeds() { var pipeline = new TestBuildPipelineWithComponents(); var config = BuildConfiguration.CreateInstance(); Assert.That(pipeline.CanBuild(config).Result, Is.True); using (var process = pipeline.BuildIncremental(config)) { while (process.Update()) { } Assert.That(process.Result.Succeeded, Is.True); } }
public void GetComponentTypes() { var pipeline = new TestBuildPipelineWithComponents(); var configB = BuildConfiguration.CreateInstance(c => c.SetComponent <TestBuildComponentB>()); var configA = BuildConfiguration.CreateInstance(c => { c.SetComponent <TestBuildComponentA>(); c.AddDependency(configB); }); var context = new TestContextBase(pipeline, configA); Assert.That(context.GetComponentTypes(), Is.EquivalentTo(new[] { typeof(TestBuildComponentA), typeof(TestBuildComponentB) })); configA.SetComponent <TestBuildComponentC>(); Assert.Throws <InvalidOperationException>(() => context.GetComponentTypes()); }
public void IsComponentInherited() { var pipeline = new TestBuildPipelineWithComponents(); var configB = BuildConfiguration.CreateInstance(c => c.SetComponent <TestBuildComponentB>()); var configA = BuildConfiguration.CreateInstance(c => { c.SetComponent <TestBuildComponentA>(); c.AddDependency(configB); }); var context = new TestContextBase(pipeline, configA); Assert.That(context.IsComponentInherited <TestBuildComponentA>(), Is.False); Assert.That(context.IsComponentInherited <TestBuildComponentB>(), Is.True); Assert.Throws <InvalidOperationException>(() => context.IsComponentInherited <TestBuildComponentC>()); Assert.Throws <ArgumentNullException>(() => context.IsComponentInherited(null)); Assert.Throws <InvalidOperationException>(() => context.IsComponentInherited(typeof(object))); Assert.Throws <InvalidOperationException>(() => context.IsComponentInherited(typeof(TestBuildComponentInvalid))); }