コード例 #1
0
        public HttpClient GetTestWriteClient()
        {
            var serverBuilder  = new IntegrationTestServerBuilder();
            var testReadServer = serverBuilder.CreateServer <TestWriteServiceStartup>();

            return(testReadServer.CreateClient());
        }
コード例 #2
0
        protected override void Load(ContainerBuilder builder)
        {
            builder.Register(r => new ApiEndpoint("http://localhost"))
            .As(typeof(IEndPoint)).SingleInstance();

            var serverBuilder = new IntegrationTestServerBuilder();

            var testReadServer = serverBuilder.CreateServer <TestReadServiceStartup>();
            var testReadClient = testReadServer.CreateClient();

            var testWriteServer = serverBuilder.CreateServer <TestWriteServiceStartup>();
            var testWriteClient = testWriteServer.CreateClient();

            builder.Register(e => new TestHttpClient(testReadClient))
            .As <IHttpReadClient>().SingleInstance();
            builder.Register(e => new TestHttpClient(testWriteClient))
            .As <IHttpWriteClient>().SingleInstance();

            builder.RegisterType <TestJwtTokenManager>().As <IJwtTokenManager>().SingleInstance();
            builder.RegisterType <TestJwtTokenManager>().As <IJwtTokenSource>().SingleInstance();
        }