Google.Api.Ads.AdWords.Tests.Util.BatchJob.v201702.BatchJobUtilitiesTest.Init()

Here are the examples of the csharp api class Google.Api.Ads.AdWords.Tests.Util.BatchJob.v201702.BatchJobUtilitiesTest.Init() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6 Examples 7

1. Example

Project: googleads-dotnet-lib
Source File: BatchJobUtilitiesTest.cs
[Test]
    public void TestInit() {
      // Any chunk size that is not a multiple of 256K should throw an
      // exception if chunking is turned on.
      Assert.Throws(typeof(ArgumentException), delegate() {
        this.Init(TEST_USER, true, TEST_NON_MULTIPLE_CHUNK_SIZE);
      });

      // Any chunk size that is a multiple of 256K should not throw an
      // exception if chunking is turned on.
      Assert.DoesNotThrow(delegate() {
        this.Init(TEST_USER, true, CHUNK_SIZE_ALIGN * 12);
      });

      // Chunk size ignored if chunking is false.
      Assert.DoesNotThrow(delegate() {
        this.Init(TEST_USER, false, TEST_NON_MULTIPLE_CHUNK_SIZE);
      });
    }

2. Example

Project: googleads-dotnet-lib
Source File: BatchJobUtilitiesTest.cs
[Test]
    public void TestUploadNoChunking() {
      uploadChunkRecords.Clear();

      // Upload with chunking turned off.
      this.Init(TEST_USER, false, TEST_NON_MULTIPLE_CHUNK_SIZE);
      Upload("http://www.example.com", TEST_DATA, 0);

      // There should be one chunk record that represents the whole data.
      Assert.That(uploadChunkRecords.Count == 1);
      Assert.That(uploadChunkRecords[0].Start == 0);
      Assert.That(uploadChunkRecords[0].End == TEST_DATA.Length - 1);
    }

3. Example

Project: googleads-dotnet-lib
Source File: BatchJobUtilitiesTest.cs
[Test]
    public void TestUploadWithChunking() {
      uploadChunkRecords.Clear();

      int numExpectedRecords = (int) (TEST_DATA.Length / TEST_CHUNK_SIZE) + 1;

      // Upload with chunking turned off.
      this.Init(TEST_USER, true, TEST_CHUNK_SIZE);
      Upload("http://www.example.com", TEST_DATA, 0);

      // There should be TESTDATA.Length % TEST_CHUNK_SIZE + 1 chunk records.
      Assert.That(uploadChunkRecords.Count == numExpectedRecords);

      UploadChunkRecord record;

      // There should be NUM_EXPECTED_RECORDS - 1 records of size = TEST_CHUNK_SIZE
      for (int i = 0; i < numExpectedRecords - 1; i++) {
        record = uploadChunkRecords[i];
        Assert.That(record.Start == i * TEST_CHUNK_SIZE);
        Assert.That(record.End == record.Start + TEST_CHUNK_SIZE - 1);
      }

      // The last record should be the leftover data.
      record = uploadChunkRecords[numExpectedRecords - 1];
      Assert.That(record.Start == (numExpectedRecords - 1) * TEST_CHUNK_SIZE);
      Assert.That(record.End == TEST_DATA.Length - 1);
    }

4. Example

Project: googleads-dotnet-lib
Source File: BatchJobUtilitiesTest.cs
[Test]
    public void TestStreamedUploadWithChunking() {
      uploadChunkRecords.Clear();

      //n ..... /n //View Source file for more details /n }

5. Example

Project: googleads-dotnet-lib
Source File: BatchJobUtilitiesTest.cs
[Test]
    public void TestUploadWithResumeAndChunking() {
      uploadChunkRecords.Clear();

      Operation[] operations = GetKeywordOperations(1000);
      string postBody = GetPostBody(operations);
      byte[] data = Encoding.UTF8.GetBytes(postBody);

      this.Init(TEST_USER, true, TEST_CHUNK_SIZE);
      Upload("http://www.example.com", operations, true);

      long numExpectedRecords = 1 + (data.Length - TESTDATA_UPLOAD_PROGRESS) / TEST_CHUNK_SIZE;
      Assert.That(uploadChunkRecords.Count == numExpectedRecords);

      for (int i = 0; i < numExpectedRecords; i++) {
        Assert.AreEqual(uploadChunkRecords[i].Start, TEST_CHUNK_SIZE * i);
        if (i == numExpectedRecords - 1) {
          Assert.AreEqual(uploadChunkRecords[i].End, data.Length - TESTDATA_UPLOAD_PROGRESS - 1);
        } else {
          Assert.AreEqual(uploadChunkRecords[i].End, uploadChunkRecords[i].Start +
              TEST_CHUNK_SIZE - 1);
        }
        Assert.AreEqual(uploadChunkRecords[i].StartOffset, TESTDATA_UPLOAD_PROGRESS);
        Assert.AreEqual(uploadChunkRecords[i].TotalUploadSize, data.Length);
      }
    }

6. Example

Project: googleads-dotnet-lib
Source File: BatchJobUtilitiesTest.cs
[Test]
    public void TestStreamedUploadNoChunking() {
      uploadChunkRecords.Clear();

      // /n ..... /n //View Source file for more details /n }