You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#455 made Moq more strict with regard to inaccessible methods: if an attempt is made to set up such a one, setup methods now throw an exception. What was forgotten back then is that mock.SetupAllProperties() will try to set even inaccessible methods (it doesn't perform the appropriate check), leading to exceptions in use cases such as #491 or the following:
internalinterfaceIFooInternals{objectC{get;}objectD{get;}}publicabstractclassFoo:IFooInternals{publicvirtualobjectC=>"C";publicobjectD=>"D";}[Fact]// does not passpublicvoidSetupAllProperties_skips_inaccessible_properties_instead_of_throwing(){varmock=newMock<Foo>();varexception=Record.Exception(()=>{mock.SetupAllProperties();});Assert.Null(exception);}
The text was updated successfully, but these errors were encountered:
#455 made Moq more strict with regard to inaccessible methods: if an attempt is made to set up such a one, setup methods now throw an exception. What was forgotten back then is that
mock.SetupAllProperties()
will try to set even inaccessible methods (it doesn't perform the appropriate check), leading to exceptions in use cases such as #491 or the following:The text was updated successfully, but these errors were encountered: