ContextFake.cs 745 B

1234567891011121314151617181920212223242526
  1. using System.Security.Principal;
  2. using Quadarax.Foundation.Core.Data.Interface.Domain;
  3. namespace Quadarax.Application.QLiberace.Base.Tests.Services.Fakes
  4. {
  5. public class ContextFake : IContext
  6. {
  7. public IPrincipal CurrentUser { get; }
  8. public ContextFake()
  9. {
  10. var genericIdentity = new GenericIdentity("genericIdentity");
  11. CurrentUser = new GenericPrincipal(genericIdentity, new string[] { });
  12. }
  13. public ContextFake(IPrincipal currentUser)
  14. {
  15. CurrentUser = currentUser;
  16. }
  17. public TContext GetContext<TContext>() where TContext : IContext
  18. {
  19. return (TContext)(IContext) this;
  20. }
  21. }
  22. }