public void CompositeBindingSourceTest_CanAcceptDataFrom_NoMatch() { // Arrange var composite = CompositeBindingSource.Create( bindingSources: new BindingSource[] { BindingSource.Query, BindingSource.Form }, displayName: "Test Source1"); // Act var result = composite.CanAcceptDataFrom(BindingSource.Path); // Assert Assert.False(result); }
public void BindingSourceValueProvider_ThrowsOnCompositeSource() { // Arrange var expected = "The provided binding source 'Test Source' is a composite. " + "'BindingSourceValueProvider' requires that the source must represent a single type of input." + Environment.NewLine + "Parameter name: bindingSource"; var bindingSource = CompositeBindingSource.Create( bindingSources: new BindingSource[] { BindingSource.Query, BindingSource.Form }, displayName: "Test Source"); // Act & Assert var exception = Assert.Throws <ArgumentException>( () => new TestableBindingSourceValueProvider(bindingSource)); Assert.Equal(expected, exception.Message); }
public void CompositeBindingSourceTest_CanAcceptDataFrom_ThrowsOnComposite() { // Arrange var expected = "The provided binding source 'Test Source2' is a composite. " + "'CanAcceptDataFrom' requires that the source must represent a single type of input." + Environment.NewLine + "Parameter name: bindingSource"; var composite1 = CompositeBindingSource.Create( bindingSources: new BindingSource[] { BindingSource.Query, BindingSource.Form }, displayName: "Test Source1"); var composite2 = CompositeBindingSource.Create( bindingSources: new BindingSource[] { BindingSource.Query, BindingSource.Form }, displayName: "Test Source2"); // Act & Assert var exception = Assert.Throws <ArgumentException>( () => composite1.CanAcceptDataFrom(composite2)); Assert.Equal(expected, exception.Message); }