public void BindingContext_Remove_Invoke_Success() { var context = new SubBindingContext(); using var source1 = new BindingSource(); var dataSource1 = new DataSource(); using var source2 = new BindingSource(); var dataSource2 = new DataSource(); context.Add(dataSource1, source1.CurrencyManager); context.Add(dataSource2, source2.CurrencyManager); context.Remove(dataSource1); Assert.Single(context); // Remove again. context.Remove(dataSource1); Assert.Single(context); context.Remove(dataSource2); Assert.Empty(context); // Remove again. context.Remove(dataSource2); Assert.Empty(context); }
public void BindingContext_Remove_NullDataSource_ThrowsArgumentNullException() { var context = new SubBindingContext(); Assert.Throws <ArgumentNullException>("dataSource", () => context.Remove(null)); }