I'm currently mocking out an Interface
with NSubstitute
, which is basically a representation of a class with two properties and one method.
LoginViewModel = Substitute.For<ILoginViewModel>();
The mocked out interface is instantiated, then passed into a method which reflects upon it to get all the custom attributes.
LoginViewModel.Username = "User1";
LoginViewModel.Password = "Password1";
Each of the properties on the concrete implementation of the interface has a single custom attribute, however when reflected, the compiler shows no custom attributes.
[CustomRequired]
public string Username { get; set; }
[CustomRequired]
public string Password { get; set; }
Testing this without NSubstitute works. My question is: Does NSubstitute strip out Custom Attributes? Or is there a way to allow them through?