public void From_Method()
 {
   var call = new DeputyTranscriptLawApiCall();
   Assert.False(call.Parameters.ContainsKey("dateFrom"));
   Assert.True(ReferenceEquals(call, call.From(DateTime.MinValue)));
   Assert.Equal(DateTime.MinValue.RuLawDate(), call.Parameters["dateFrom"]);
 }
 public void Deputy_Method()
 {
   var call = new DeputyTranscriptLawApiCall();
   Assert.False(call.Parameters.ContainsKey("deputy"));
   Assert.True(ReferenceEquals(call, call.Deputy(1)));
   Assert.Equal((long) 1, call.Parameters["deputy"]);
 }
 public void PageSize_Method()
 {
   var call = new DeputyTranscriptLawApiCall();
   Assert.False(call.Parameters.ContainsKey("limit"));
   Assert.True(ReferenceEquals(call, call.PageSize(PageSize.Five)));
   Assert.Equal(5, call.Parameters["limit"]);
 }
 public void Page_Method()
 {
   var call = new DeputyTranscriptLawApiCall();
   Assert.False(call.Parameters.ContainsKey("page"));
   Assert.True(ReferenceEquals(call, call.Page(1)));
   Assert.Equal(1, call.Parameters["page"]);
 }
    public void Name_Method()
    {
      Assert.Throws<ArgumentNullException>(() => new DeputyTranscriptLawApiCall().Name(null));
      Assert.Throws<ArgumentException>(() => new DeputyTranscriptLawApiCall().Name(string.Empty));

      var call = new DeputyTranscriptLawApiCall();
      Assert.False(call.Parameters.ContainsKey("name"));
      Assert.True(ReferenceEquals(call, call.Name("name")));
      Assert.Equal("name", call.Parameters["name"]);
    }
    public void Deputy_Method()
    {
      Assert.Throws<ArgumentNullException>(() => IDeputyTranscriptLawApiCallExtensions.Deputy(null, new Deputy()));
      Assert.Throws<ArgumentNullException>(() => new DeputyTranscriptLawApiCall().Deputy(null));

      var call = new DeputyTranscriptLawApiCall();
      Assert.False(call.Parameters.ContainsKey("deputy"));
      Assert.True(ReferenceEquals(call, call.Deputy(new Deputy { Id = 1 })));
      Assert.Equal((long) 1, call.Parameters["deputy"]);
    }
    /// <summary>
    ///   <para>Returns transcription of deputy's speeches.</para>
    /// </summary>
    /// <param name="caller">API caller instance to be used.</param>
    /// <param name="call">Delegate to configure additional parameters of request.</param>
    /// <returns>Deputy's transcripts result.</returns>
    /// <exception cref="ArgumentNullException">If either <paramref name="caller"/> or <paramref name="call"/> is a <c>null</c> reference.</exception>
    /// <exception cref="RuLawException">If there was an error during processing of web request, or if request was considered as invalid.</exception>
    /// <seealso cref="http://api.duma.gov.ru/pages/dokumentatsiya/stenogrammi-vistupleniy-deputata"/>
    public static IDeputyTranscriptsResult Deputy(this ITranscriptsApiCaller caller, Action<IDeputyTranscriptLawApiCall> call)
    {
      Assertion.NotNull(caller);
      Assertion.NotNull(call);

      var api = new DeputyTranscriptLawApiCall();
      call(api);

      var deputy = api.Parameters["deputy"];
      api.Parameters.Remove("deputy");
      return caller.Api.Call<DeputyTranscriptsResult>("/{0}/transcriptDeputy/{1}".FormatSelf(caller.Api.ApiToken, deputy), api.Parameters).Data;
    }
 public void Constructors()
 {
   var call = new DeputyTranscriptLawApiCall();
   Assert.False(call.Parameters.Any());
 }