public void ShortcutRemoval() { // Arrange var resolver = new ProcessBindingResolverFactory().Create("ProductInstance.Type.Dummy.ProductType.Name"); var process = DummyProcess(); int oldCount = 0, newCount = 0; // Act var current = (IBindingResolverChain)resolver; while (current.NextResolver != null) { oldCount++; current = current.NextResolver; } var result = resolver.Resolve(process); current = (IBindingResolverChain)resolver; while (current.NextResolver != null) { newCount++; current = current.NextResolver; } // Assert Assert.AreEqual("Bob", result); Assert.LessOrEqual(newCount, oldCount); Assert.AreEqual(8, oldCount); Assert.AreEqual(4, newCount); }
public void WrongOrderOfResolver() { // Arrange var resolver = new ProcessBindingResolverFactory().Create("Product.Part.Identifier"); // Assert Assert.DoesNotThrow(() => resolver.Resolve(DummyProcess())); }
public void NameConflict() { // Arrange var resolver = new ProcessBindingResolverFactory().Create("Product.Part.Id"); // Assert Assert.Throws <InvalidOperationException>(() => resolver.Resolve(DummyProcess())); }
public void PlainResolve(string path, Type resultType) { // Arrange var resolver = new ProcessBindingResolverFactory().Create(path); // Act var process = DummyProcess(); var result = resolver.Resolve(process); // Assert Assert.AreEqual(resultType, result.GetType(), "Wrong object resolved"); }