Пример #1
0
 public ChannelQueryTest()
 {
     var server = new TestServer(new WebHostBuilder()
         .UseStartup<Startup>()
         .UseConfiguration(AppSettingsProvider.GetConfigurationRoot()));
     _client = server.CreateClient();
     _client.DefaultRequestHeaders.Authorization = TestingUtils.GetTokenForTestingUser(_client);
 }
Пример #2
0
        protected override void Load(ContainerBuilder builder)
        {
            var configurationRoot = AppSettingsProvider.GetConfigurationRoot();
            var appConfig         = configurationRoot.GetSection("App").Get <AppSettings>();

            builder.RegisterModule(new CoreModule());
            builder.RegisterModule(new DataModule(appConfig));
            builder.RegisterModule(new GraphQLModule());
            builder.RegisterModule(new TestingModule());

            var identityService = new Mock <IIdentityService>();

            identityService.Setup(x => x.GetIdentity(TestingConstants.UserName,
                                                     TestingConstants.UserPassword))
            .Returns(
                Task.FromResult(
                    new ClaimsIdentity(
                        new GenericIdentity(TestingConstants.UserName, "Token"),
                        new Claim[] { }
                        )
                    ));

            builder.RegisterInstance(identityService.Object);
        }