예제 #1
0
            public void AuthSetup(string accessToken, string refreshToken)
            {
                StartServer();
                StaticMethodWrapperMock
                .Setup(t => t.StartProcess(It.IsAny <string>()))
                .Callback((string url) =>
                {
                    //We need to invoke the appropriate method on the signin handler - Easiest way is to just make the call the browser would
                    Task.Run(() =>
                    {
                        using var client = new HttpClient();
                        client.GetAsync(url);
                        Thread.Sleep(TimeSpan.FromSeconds(10));
                    });
                });

                var handler = new UserSigninHandler(RedirectUrl, accessToken, refreshToken, TokenGenerator);

                HttpMock.HttpMock
                .WhenGet(handler.AuthPath)
                .Do(context => { handler.Handle(context); });
                HttpMock.HttpMock
                .WhenPost(handler.AuthPath, context => true)
                .Do(context => { handler.Handle(context); });
            }
            public void AuthSetup(string accessToken, string refreshToken)
            {
                StartServer();
                StaticMethodWrapperMock
                .Setup(t => t.StartProcess(It.IsAny <string>()))
                .Callback((string url) =>
                {
                    //We need to invoke the appropriate method on the signin handler - Easiest way is to just make the call the browser would
                    Task.Run(() =>
                    {
                        using (var client = new HttpClient())
                        {
                            client.GetAsync(url);
                            Thread.Sleep(100);
                        }
                    });
                });

                HttpMock.HttpMock.Add(new UserSigninHandler(RedirectUrl, accessToken, refreshToken, TokenGenerator));
            }