TestClassWithPrivateSetters.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace S7.Net.UnitTest.Helpers
  6. {
  7. class TestClassWithPrivateSetters : TestClass
  8. {
  9. public const int PRIVATE_SETTER_VALUE = 42;
  10. public const int PROTECTED_SETTER_VALUE = 1337;
  11. public const int INTERNAL_SETTER_VALUE = 31137;
  12. public const int JUST_A_GETTER_VALUE = 4711;
  13. public int PrivateSetterProperty
  14. {
  15. get { return PRIVATE_SETTER_VALUE; }
  16. private set { throw new NotSupportedException("Shouldn't access private setter"); }
  17. }
  18. public int ProtectedSetterProperty
  19. {
  20. get { return PROTECTED_SETTER_VALUE; }
  21. private set { throw new NotSupportedException("Shouldn't access protected setter"); }
  22. }
  23. public int InternalSetterProperty
  24. {
  25. get { return INTERNAL_SETTER_VALUE; }
  26. private set { throw new NotSupportedException("Shouldn't access internal setter"); }
  27. }
  28. public int JustAGetterProperty
  29. {
  30. get { return JUST_A_GETTER_VALUE; }
  31. }
  32. }
  33. }