text:
package cakemix

import akka.actor.Actor
import scala.concurrent.{ ExecutionContext, ExecutionContextExecutor }

/**
 * Simple mixin trait for providing an ExecutionContext. Very useful in
 * any Scala code that uses or transforms Futures or the Akka ask pattern.
 */
trait ExecutionContextProvider {
  implicit def executionContext: ExecutionContext
}

/**
 * Implementation of ExecutionContextProvider that bridges with
 * [[cakemix.ActorRefFactoryProvider]] so anything that provides an
 * ActorRefFactory will get the dispatcher of the associated ActorSystem
 * provided as the ExecutionContext.
 */
trait ActorRefFactoryExecutionContextProvider extends ExecutionContextProvider with ActorRefFactoryProvider {
  implicit def executionContext: ExecutionContextExecutor = actorRefFactory.dispatcher
}

/**
 * Implementation of [[cakemix.ExecutionContextProvider]] for use in Actors.
 * It uses the Actor's context dispatcher as the ExecutionContext.
 */
trait ActorExecutionContextProvider extends ExecutionContextProvider { this: Actor =>
  implicit def executionContext: ExecutionContextExecutor = context.dispatcher
}

/**
 * Implementation of [[cakemix.ExecutionContextProvider]] that uses the
 * ExecutionContext provided by scala.concurrent.ExecutionContext.global.
 */
trait GlobalExecutionContextProvider {
  implicit def executionContext: ExecutionContext = scala.concurrent.ExecutionContext.global
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="snake">
<meta name="author" content="Benjamin Vreeland">

<title>Face Snake</title>

<link href="./resources/snake.css" rel="stylesheet">

<?php

$scale = filter_input(INPUT_GET, "scale", FILTER_VALIDATE_INT);
$speed = filter_input(INPUT_GET, "speed", FILTER_VALIDATE_INT);
$snake_url = filter_input(INPUT_GET, "snake_url", FILTER_VALIDATE_URL);
$food_url = filter_input(INPUT_GET, "food_url", FILTER_VALIDATE_URL);

function default_val(&$var, $default) {
	if (empty($var) || (intval($default)&&(!intval($var)||(intval($var)<=0)))) {
		$var = $default;
	}
}

default_val($scale, 20);
default_val($speed, intval($scale/2));
default_val($snake_url, "https://emojis.slackmojis.com/emojis/images/1563480763/5999/meow_party.gif");
default_val($food_url, "https://emojis.slackmojis.com/emojis/images/1457563042/312/doge.png");

?>

New Game

		<form id= "new-game">
			Size: <input type="range" id="scale" name="scale" min="10" max="40" value="<?= $scale ?>">
			Speed: <input type="range" id="speed" name="speed" min="5" max="20" value="<?= $speed ?>">
			Snake Picture: <input type="text" id="snake_url" name="snake_url" value="<?= $snake_url ?>">
			Food Picture: <input type="text" id="food_url" name="food_url" value="<?= $food_url ?>">
			<input type="button" value="Begin New Game" onclick="softSubmit(ops);">
		</form>

	<canvas id="game-canvas" width="600" height="600"></canvas>

Score: 0

redpajama_set_name: RedPajamaGithub


text:
package org.marre.sms;

/**
 * Supported MWI types.
 */
public enum MwiType {
    /** Message waiting type : VOICE */
    VOICE,
    /** Message waiting type : FAX */
    FAX,
    /** Message waiting type : EMAIL */
    EMAIL,
    /** Message waiting type : VIDEO */
    VIDEO,
}


text:
"""Tests for the private `_RebatchDataset` transformation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from absl.testing import parameterized
import numpy as np

from tensorflow.python.data.experimental.ops import distribute
from tensorflow.python.data.kernel_tests import test_base
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import nest
from tensorflow.python.framework import combinations
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops import image_ops
from tensorflow.python.ops.ragged import ragged_tensor
from tensorflow.python.platform import test

def _flat_shapes(dataset):
  return nest.flatten(dataset_ops.get_legacy_output_shapes(dataset))

class RebatchDatasetTest(test_base.DatasetTestBase, parameterized.TestCase):

  @combinations.generate(
      combinations.times(test_base.default_test_combinations(),
                         combinations.combine(drop_remainder=[True, False])))
  def testBasic(self, drop_remainder):
    dataset = dataset_ops.Dataset.range(1024).batch(
        32, drop_remainder=drop_remainder)
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=4)
    self.assertEqual([[8] if drop_remainder else [None]],
                     [ts.as_list() for ts in _flat_shapes(rebatched_dataset)])

    expected_output = [[k for k in range(i, i + 8)] for i in range(0, 1024, 8)]  # pylint: disable=g-complex-comprehension
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(test_base.default_test_combinations())
  def testCanHandleUnknownRank(self):
    dataset = dataset_ops.Dataset.from_tensors("xxx")
    # decode_image results in a tensor of completely unknown shape (i.e. unknown
    # rank)
    dataset = dataset.map(image_ops.decode_image)
    self.assertEqual([tensor_shape.TensorShape(None)], _flat_shapes(dataset))
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=4)
    # Note that we are just testing the dataset shapes, not the actual output.
    self.assertEqual([tensor_shape.TensorShape(None)],
                     _flat_shapes(rebatched_dataset))

  @combinations.generate(test_base.default_test_combinations())
  def testCanHandleUnknownDims(self):
    dataset = dataset_ops.Dataset.range(1000)
    dataset = dataset.batch(10, drop_remainder=False)
    dataset = dataset.batch(10, drop_remainder=False)
    self.assertEqual([[None, None]],
                     [ts.as_list() for ts in _flat_shapes(dataset)])
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=4)
    # Note that we are just testing the dataset shapes, not the actual output.
    self.assertEqual([[None, None]],
                     [ts.as_list() for ts in _flat_shapes(rebatched_dataset)])

  @combinations.generate(test_base.default_test_combinations())
  def testScalarInputError(self):
    dataset = dataset_ops.Dataset.range(1024)
    distribute._RebatchDataset(dataset.batch(4), num_replicas=4)
    with self.assertRaisesRegexp(ValueError, ("You can fix the issue "
                                              "by adding the `batch`")):
      distribute._RebatchDataset(dataset, num_replicas=4)

  @combinations.generate(
      combinations.times(test_base.default_test_combinations(),
                         combinations.combine(drop_remainder=[True, False])))
  def testBatchNotDivisibleByNumReplicas(self, drop_remainder):
    dataset = dataset_ops.Dataset.range(1024).batch(
        32, drop_remainder=drop_remainder)
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=5)
    self.assertEqual([[None]],
                     [ts.as_list() for ts in _flat_shapes(rebatched_dataset)])
    expected_output = []
    i = 0
    for _ in range(32):  # number of steps
      # first four minibatches have seven elements
      for _ in range(4):
        expected_output.append([k for k in range(i, i + 7)])
        i += 7
      # last minibatch has four elements
      expected_output.append([k for k in range(i, i + 4)])
      i += 4
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(test_base.default_test_combinations())
  def testBatchSizeNotDivisibleByNumReplicas2(self):
    dataset = dataset_ops.Dataset.range(32).batch(16, drop_remainder=True)
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=5)
    # This will rebatch into sub-batches of size 4, since
    # ceil(16 / 5) = 4. However, that means only the first 4 replicas will get
    # data.
    expected_output = [[k for k in range(i, i + 4)] for i in range(0, 16, 4)]
    expected_output.extend([[]])  # Last replica gets an empty batch
    expected_output.extend(
        [[k for k in range(i, i + 4)] for i in range(16, 32, 4)])
    expected_output.extend([[]])  # Last replica gets an empty batch
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(test_base.default_test_combinations())
  def testTupleOutput(self):
    dataset = dataset_ops.Dataset.range(1024).map(lambda x: (x, x)).batch(32)
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=4)
    expected_output = [([k for k in range(i, i + 8)],  # pylint: disable=g-complex-comprehension
                        [k for k in range(i, i + 8)])
                       for i in range(0, 1024, 8)]
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(test_base.default_test_combinations())
  def testNestedDictionaryOutput(self):
    dataset = dataset_ops.Dataset.range(1024).map(
        lambda x: {"a": x, "b": {"c": x}}).batch(32)
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=4)
    expected_output = [{"a": [k for k in range(i, i + 8)],  # pylint: disable=g-complex-comprehension
                        "b": {"c": [k for k in range(i, i + 8)]}}
                       for i in range(0, 1024, 8)]
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(
      combinations.times(test_base.default_test_combinations(),
                         combinations.combine(drop_remainder=[True, False])))
  def testFinalPartialBatch(self, drop_remainder):
    dataset = dataset_ops.Dataset.range(1032).batch(
        32, drop_remainder=drop_remainder)
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=4)
    self.assertEqual([[8] if drop_remainder else [None]],
                     [ts.as_list() for ts in _flat_shapes(rebatched_dataset)])

    # if drop_remainder, the final partial batch is dropped, even though it
    # makes up a complete minibatch.
    expected_output = [[k for k in range(i, i + 8)] for i in range(0, 1024, 8)]  # pylint: disable=g-complex-comprehension
    if not drop_remainder:
      # The last partial batch of size 8 is split over 4 replicas
      expected_output.extend(
          [[k for k in range(i, i + 2)] for i in range(1024, 1032, 2)])
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(
      combinations.times(test_base.default_test_combinations(),
                         combinations.combine(drop_remainder=[True, False])))
  def testFinalPartialBatchAfterRebatch(self, drop_remainder):
    dataset = dataset_ops.Dataset.range(34).batch(
        32, drop_remainder=drop_remainder)
    rebatched_dataset = distribute._RebatchDataset(dataset, num_replicas=4)
    self.assertEqual([[8] if drop_remainder else [None]],
                     [ts.as_list() for ts in _flat_shapes(rebatched_dataset)])

    expected_output = [[k for k in range(i, i + 8)] for i in range(0, 32, 8)]  # pylint: disable=g-complex-comprehension
    if not drop_remainder:
      # The last partial batch of size 2 is split over 4 replicas
      expected_output += [[32], [33], [], []]
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(test_base.default_test_combinations())
  def testMultipleBatches(self):
    dataset = dataset_ops.Dataset.range(128).batch(4).batch(8)
    self.assertEqual([[None, None]],
                     [ts.as_list() for ts in _flat_shapes(dataset)])

    # Each element is a list of 8 elements where each element is a list of 4.
    expected_output = [[[j, j + 1, j + 2, j + 3]  # pylint: disable=g-complex-comprehension
                        for j in range(i, i + 32, 4)]  # generates 8 elements
                       for i in range(0, 128, 32)]
    self.assertDatasetProduces(dataset, expected_output)

    rebatched_dataset = distribute._RebatchDataset(dataset, 4)
    self.assertEqual([[None, None]],
                     [ts.as_list() for ts in _flat_shapes(rebatched_dataset)])
    # Each element is a list of 2 elements where each element is a list of 4.
    expected_output = [[[j, j + 1, j + 2, j + 3]  # pylint: disable=g-complex-comprehension
                        for j in range(i, i + 8, 4)]  # generates 2 elements
                       for i in range(0, 128, 8)]
    self.assertDatasetProduces(rebatched_dataset, expected_output)

  @combinations.generate(test_base.default_test_combinations())
  def testRaggedTensorDataset(self):
    # Set up a dataset that produces ragged tensors with a static batch size.
    row_lengths = np.random.randint(8, size=128)
    values = np.random.normal(size=np.sum(row_lengths)).astype(np.float32)
    dataset = dataset_ops.Dataset.from_tensor_slices(
        ragged_tensor.RaggedTensor.from_row_lengths(values, row_lengths))
    dataset = dataset.batch(32, drop_remainder=True)

    # The map changes the internal representation of the ragged tensor.
    # This test will fail if we don't normalize the tensor representation.
    dataset = dataset.map(lambda x: x)

    dataset = distribute._RebatchDataset(dataset, num_replicas=8)
    # After rebatching, batch size is now 4.
    expected_output = []
    value_index = 0
    for batch_row_lengths in row_lengths.reshape((-1, 4)):
      num_values = np.sum(batch_row_lengths)
      expected_output.append(
          ragged_tensor.RaggedTensor.from_row_lengths(
              values[value_index:(value_index + num_values)],
              batch_row_lengths))
      value_index += num_values
    self.assertDatasetProduces(dataset, expected_output)

if __name__ == "__main__":
  test.main()


text:
require 'generators/generators_test_helper'
require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
require 'mocha/setup' # FIXME: stop using mocha

# Mock out what we need from AR::Base.
module ActiveRecord
  class Base
    class << self
      attr_accessor :pluralize_table_names
    end
    self.pluralize_table_names = true
  end
end

class NamedBaseTest < Rails::Generators::TestCase
  include GeneratorsTestHelper
  tests Rails::Generators::ScaffoldControllerGenerator

  def test_named_generator_with_underscore
    g = generator ['line_item']
    assert_name g, 'line_item',  :name
    assert_name g, %w(),         :class_path
    assert_name g, 'LineItem',   :class_name
    assert_name g, 'line_item',  :file_path
    assert_name g, 'line_item',  :file_name
    assert_name g, 'Line item',  :human_name
    assert_name g, 'line_item',  :singular_name
    assert_name g, 'line_items', :plural_name
    assert_name g, 'line_item',  :i18n_scope
    assert_name g, 'line_items', :table_name
  end

  def test_named_generator_attributes
    g = generator ['admin/foo']
    assert_name g, 'admin/foo',  :name
    assert_name g, %w(admin),    :class_path
    assert_name g, 'Admin::Foo', :class_name
    assert_name g, 'admin/foo',  :file_path
    assert_name g, 'foo',        :file_name
    assert_name g, 'Foo',        :human_name
    assert_name g, 'foo',        :singular_name
    assert_name g, 'foos',       :plural_name
    assert_name g, 'admin.foo',  :i18n_scope
    assert_name g, 'admin_foos', :table_name
  end

  def test_named_generator_attributes_as_ruby
    g = generator ['Admin::Foo']
    assert_name g, 'Admin::Foo', :name
    assert_name g, %w(admin),    :class_path
    assert_name g, 'Admin::Foo', :class_name
    assert_name g, 'admin/foo',  :file_path
    assert_name g, 'foo',        :file_name
    assert_name g, 'foo',        :singular_name
    assert_name g, 'Foo',        :human_name
    assert_name g, 'foos',       :plural_name
    assert_name g, 'admin.foo',  :i18n_scope
    assert_name g, 'admin_foos', :table_name
  end

  def test_named_generator_attributes_without_pluralized
    ActiveRecord::Base.pluralize_table_names = false
    g = generator ['admin/foo']
    assert_name g, 'admin_foo', :table_name
  ensure
    ActiveRecord::Base.pluralize_table_names = true
  end

  def test_scaffold_plural_names
    g = generator ['admin/foo']
    assert_name g, 'admin/foos',  :controller_name
    assert_name g, %w(admin),     :controller_class_path
    assert_name g, 'Admin::Foos', :controller_class_name
    assert_name g, 'admin/foos',  :controller_file_path
    assert_name g, 'foos',        :controller_file_name
    assert_name g, 'admin.foos',  :controller_i18n_scope
  end

  def test_scaffold_plural_names_as_ruby
    g = generator ['Admin::Foo']
    assert_name g, 'Admin::Foos', :controller_name
    assert_name g, %w(admin),     :controller_class_path
    assert_name g, 'Admin::Foos', :controller_class_name
    assert_name g, 'admin/foos',  :controller_file_path
    assert_name g, 'foos',        :controller_file_name
    assert_name g, 'admin.foos',  :controller_i18n_scope
  end

  def test_application_name
    g = generator ['Admin::Foo']
    Rails.stubs(:application).returns(Object.new)
    assert_name g, "object", :application_name
    Rails.stubs(:application).returns(nil)
    assert_name g, "application", :application_name
  end

  def test_index_helper
    g = generator ['Post']
    assert_name g, 'posts', :index_helper
  end

  def test_index_helper_to_pluralize_once
    g = generator ['Stadium']
    assert_name g, 'stadia', :index_helper
  end

  def test_index_helper_with_uncountable
    g = generator ['Sheep']
    assert_name g, 'sheep_index', :index_helper
  end

  def test_hide_namespace
    g = generator ['Hidden']
    g.class.stubs(:namespace).returns('hidden')

    assert !Rails::Generators.hidden_namespaces.include?('hidden')
    g.class.hide!
    assert Rails::Generators.hidden_namespaces.include?('hidden')
  end

  def test_scaffold_plural_names_with_model_name_option
    g = generator ['Admin::Foo'], model_name: 'User'
    assert_name g, 'user',        :singular_name
    assert_name g, 'User',        :name
    assert_name g, 'user',        :file_path
    assert_name g, 'User',        :class_name
    assert_name g, 'user',        :file_name
    assert_name g, 'User',        :human_name
    assert_name g, 'users',       :plural_name
    assert_name g, 'user',        :i18n_scope
    assert_name g, 'users',       :table_name
    assert_name g, 'Admin::Foos', :controller_name
    assert_name g, %w(admin),     :controller_class_path
    assert_name g, 'Admin::Foos', :controller_class_name
    assert_name g, 'admin/foos',  :controller_file_path
    assert_name g, 'foos',        :controller_file_name
    assert_name g, 'admin.foos',  :controller_i18n_scope
  end

  protected

    def assert_name(generator, value, method)
      assert_equal value, generator.send(method)
    end
end


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
{
    /// <summary>
    /// Endpoint Uris, authentication bootstrapping information and other metadata required to communicate with a particular azure cloud
    /// </summary>
    public interface IAzureEnvironment : IExtensibleModel
    {
        /// <summary>
        /// The name of the environment
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Determines of the environment use AAD authentication (false) or ADFS authentication (true)
        /// </summary>
        bool OnPremise { get; set; }

        /// <summary>
        /// The RDFE endpoint
        /// </summary>
        string ServiceManagementUrl { get; set; }

        /// <summary>
        /// The Resource Manager endpoint
        /// </summary>
        string ResourceManagerUrl { get; set; }

        /// <summary>
        /// The location fot eh manageemnt portal
        /// </summary>
        string ManagementPortalUrl { get; set; }

        /// <summary>
        /// The location fo the publish settings doenload web application
        /// </summary>
        string PublishSettingsFileUrl { get; set; }

        /// <summary>
        /// The Active Directory authentication endpoint
        /// </summary>
        string ActiveDirectoryAuthority { get; set; }

        /// <summary>
        /// The ARM template gallery endpoint.
        /// </summary>
        string GalleryUrl { get; set; }

        /// <summary>
        /// The Azure Active Directory Graph endpoint
        /// </summary>
        string GraphUrl { get; set; }

        /// <summary>
        /// The token audience required to access the RDFE or ARM endpoints
        /// </summary>
        string ActiveDirectoryServiceEndpointResourceId { get; set; }

        /// <summary>
        /// The domain name suffix for storage services
        /// </summary>
        string StorageEndpointSuffix { get; set; }

        /// <summary>
        /// The domain name suffix for Sql databases
        /// </summary>
        string SqlDatabaseDnsSuffix { get; set; }

        /// <summary>
        /// The domain anme suffix for traffic manager endpoints
        /// </summary>
        string TrafficManagerDnsSuffix { get; set; }

        /// <summary>
        /// The domain name suffix for Azure KeyVault valuts
        /// </summary>
        string AzureKeyVaultDnsSuffix { get; set; }

        /// <summary>
        /// The token audience required for authenticating with Azure KeyVault vaults
        /// </summary>
        string AzureKeyVaultServiceEndpointResourceId { get; set; }

        /// <summary>
        /// The token audience required to authenticate with the Azure Active Directory Graph services
        /// </summary>
        string GraphEndpointResourceId { get; set; }

        /// <summary>
        /// The token audience required to authenticate with the Azure Active Directory Data Lake services
        /// </summary>
        string DataLakeEndpointResourceId { get; set; }

        /// <summary>
        /// The token audience required to authenticate with the Azure Batch service
        /// </summary>
        string BatchEndpointResourceId { get; set; }

        /// <summary>
        ///  The domain name suffix for Azure DataLake Catalog and Job services
        /// </summary>
        string AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix { get; set; }

        /// <summary>
        /// The domain name suffix for Azure Data Lake FileSyattem services
        /// </summary>
        string AzureDataLakeStoreFileSystemEndpointSuffix { get; set; }

        /// <summary>
        /// The default Active Directory Tenant
        /// </summary>
        string AdTenant { get; set; }

        /// <summary>
        /// The set of version profile s(service capabilities) supported
        /// </summary>
        IList<string> VersionProfiles { get; }
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Linq;
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;

namespace Cake.Common.Tools.MSTest
{
    /// <summary>
    /// The MSTest unit test runner.
    /// </summary>
    public sealed class MSTestRunner : Tool<MSTestSettings>
    {
        private readonly IFileSystem _fileSystem;
        private readonly ICakeEnvironment _environment;

        /// <summary>
        /// Initializes a new instance of the <see cref="MSTestRunner"/> class.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="environment">The environment.</param>
        /// <param name="processRunner">The process runner.</param>
        /// <param name="tools">The tool locator.</param>
        public MSTestRunner(
            IFileSystem fileSystem,
            ICakeEnvironment environment,
            IProcessRunner processRunner,
            IToolLocator tools) : base(fileSystem, environment, processRunner, tools)
        {
            _fileSystem = fileSystem;
            _environment = environment;
        }

        /// <summary>
        /// Runs the tests in the specified assembly.
        /// </summary>
        /// <param name="assemblyPaths">The assembly path.</param>
        /// <param name="settings">The settings.</param>
        public void Run(IEnumerable<FilePath> assemblyPaths, MSTestSettings settings)
        {
            if (assemblyPaths == null)
            {
                throw new ArgumentNullException(nameof(assemblyPaths));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Run(settings, GetArguments(assemblyPaths, settings));
        }

        private ProcessArgumentBuilder GetArguments(IEnumerable<FilePath> assemblyPaths, MSTestSettings settings)
        {
            var builder = new ProcessArgumentBuilder();

            // Add the assembly to build.
            foreach (var assemblyPath in assemblyPaths)
            {
                builder.Append(string.Concat("/testcontainer:", assemblyPath.MakeAbsolute(_environment).FullPath).Quote());
            }

            if (!string.IsNullOrEmpty(settings.Category))
            {
                builder.Append(string.Concat("/category:", settings.Category.Quote()));
            }

            if (!string.IsNullOrEmpty(settings.ResultsFile))
            {
                builder.Append(string.Concat("/resultsfile:", settings.ResultsFile.Quote()));
            }

            if (settings.NoIsolation)
            {
                builder.Append("/noisolation");
            }

            if (settings.TestSettings != null)
            {
                builder.Append(
                    string.Concat("/testsettings:", settings.TestSettings.MakeAbsolute(_environment).FullPath.Quote()));
            }

            return builder;
        }

        /// <summary>
        /// Gets the name of the tool.
        /// </summary>
        /// <returns>The tool name.</returns>
        protected override string GetToolName()
        {
            return "MSTest";
        }

        /// <summary>
        /// Gets the possible names of the tool executable.
        /// </summary>
        /// <returns>The tool executable name.</returns>
        protected override IEnumerable<string> GetToolExecutableNames()
        {
            return Enumerable.Empty<string>();
        }

        /// <summary>
        /// Gets alternative file paths which the tool may exist in.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <returns>The default tool path.</returns>
        protected override IEnumerable<FilePath> GetAlternativeToolPaths(MSTestSettings settings)
        {
            var vsRootRelativeToolPath = FilePath.FromString("Common7/IDE/mstest.exe");
            foreach (var year in VisualStudio.Versions.TwentySeventeenAndLater)
            {
                foreach (var edition in settings.AllowPreviewVersion
                             ? VisualStudio.Editions.All
                             : VisualStudio.Editions.Stable)
                {
                    var path = VisualStudio.GetYearAndEditionToolPath(_environment, year, edition, vsRootRelativeToolPath);
                    if (_fileSystem.Exist(path))
                    {
                        yield return path;
                    }
                }
            }

            foreach (var version in VisualStudio.Versions.TenToFourteen)
            {
                var path = VisualStudio.GetVersionNumberToolPath(_environment, version, vsRootRelativeToolPath);
                if (_fileSystem.Exist(path))
                {
                    yield return path;
                }
            }

            foreach (var environmentVariable in new[] { "VS140COMNTOOLS", "VS130COMNTOOLS", "VS120COMNTOOLS", "VS110COMNTOOLS", "VS100COMNTOOLS" })
            {
                var path = GetCommonToolPath(environmentVariable);
                if (path != null && _fileSystem.Exist(path))
                {
                    yield return path;
                }
            }
        }

        private FilePath GetCommonToolPath(string environmentVariable)
        {
            var visualStudioCommonToolsPath = _environment.GetEnvironmentVariable(environmentVariable);

            if (string.IsNullOrWhiteSpace(visualStudioCommonToolsPath))
            {
                return null;
            }

            var root = new DirectoryPath(visualStudioCommonToolsPath).Combine("../IDE").Collapse();
            return root.CombineWithFilePath("mstest.exe");
        }
    }
}