public void Should_Return_Current_Principal()
        {
            var accessor = new Mock<IHttpContextAccessor>();
            var contextMock = new HttpContextMoq();
            var fakePrincipal = new GenericPrincipal(new GenericIdentity("TEST"), null);
            contextMock.MockContext.Setup(r => r.User).Returns(() => fakePrincipal);
            accessor.Setup(r => r.GetCurrent()).Returns(() => contextMock.MockContext.Object);

            var provider = new DefaultWebPrincipalProvider(accessor.Object);
            var principal = provider.GetCurrentPrincipal();

            Assert.AreEqual(principal, fakePrincipal);
        }
        public void ShouldResolve_Commands_Successfully()
        {
            var containerBuilder = new ContainerBuilder();
            containerBuilder.RegisterType(typeof(CommandTest)).AsSelf();
            ContextScopeProvider.RegisterTypes(containerBuilder);

            var httpContextMoq = new HttpContextMoq();
            var accessor = new Mock<IHttpContextAccessor>();
            accessor
                .Setup(a => a.GetCurrent())
                .Returns(() => httpContextMoq.HttpContextBase);

            var provider = new PerWebRequestContainerProvider(accessor.Object);
            var resolver = new DefaultCommandResolver(provider);

            var commandContext = new CommandContextTest();
            var command = resolver.ResolveCommand<CommandTest>(commandContext);
            Assert.IsNotNull(command);
            Assert.AreEqual(command.Context, commandContext);
        }