コード例 #1
0
ファイル: Setup.cs プロジェクト: markvincze/Stubbery
        public ISetup Response(CreateStubResponse responder)
        {
            if (responder == null)
            {
                throw new ArgumentNullException(nameof(responder));
            }

            if (setupResponse.Responder != null)
            {
                throw new InvalidOperationException("The response is already set. It cannot be set multiple times.");
            }

            setupResponse.Responder = responder;

            return(this);
        }
コード例 #2
0
ファイル: ApiStub.cs プロジェクト: lakrsv/Stubbery
 /// <summary>
 /// Sets up a new stubbed GET request on a specific route with a response.
 /// </summary>
 /// <param name="route">The route on which the stub will respond.</param>
 /// <param name="responder">The stubbed response to send.</param>
 /// <returns>An <see cref="ISetup" /> object on which further conditions can be set.</returns>
 public ISetup Get(string route, CreateStubResponse responder)
 {
     return(Request(HttpMethod.Get)
            .IfRoute(route)
            .Response(responder));
 }