public void Test_Contains_Calls_UnderlyingDataGridViewContainsMethod() { //---------------Set up test pack------------------- DataGridViewColumnCollection mock; IDataGridViewColumnCollection columnCollection = GetColumnCollectionWithMock(out mock); string columnName = TestUtil.GetRandomString(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- columnCollection.Contains(columnName); //---------------Test Result ----------------------- mock.AssertWasCalled(collection => collection.Contains(columnName)); }
public void Test_Contains_ReturnsValueOf_UnderlyingDataGridViewContainsMethod_WhenTrue() { //---------------Set up test pack------------------- string columnName = TestUtil.GetRandomString(); const bool expectedReturn = true; DataGridViewColumnCollection mock; IDataGridViewColumnCollection columnCollection = GetColumnCollectionWithMock(out mock); mock.Stub(t => mock.Contains(columnName)).Return(expectedReturn); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- bool returnValue = columnCollection.Contains(columnName); //---------------Test Result ----------------------- Assert.AreEqual(expectedReturn, returnValue); }