public void should_use_explict_interface_impl_if_you_want_to_hide_something_for_certain_type() { var readOnlyStreamWithWriteExplicitlyImpl = new ReadOnlyStream(); var hasWriteMethod = readOnlyStreamWithWriteExplicitlyImpl.HasInstanceMethod( "Write", new[] {typeof(string)}); // change the variable value to fix the test. const bool expectedHasWriteMethod = true; Assert.Equal(expectedHasWriteMethod, hasWriteMethod); }
public void should_invoke_explicitly_implemented_method_by_original_interface() { var readOnlyStreamWithWriteExplicitlyImpl = new ReadOnlyStream(); var castedToInterface = (ITextStream) readOnlyStreamWithWriteExplicitlyImpl; castedToInterface.Write("Hehe"); var readResult = readOnlyStreamWithWriteExplicitlyImpl.Read(); // change the variable value to fix the test. const string expectedReadResult = ""; Assert.Equal(expectedReadResult, readResult); }