public void PhraseWasReversed() { var calculatedValue = TestFunctions.ReversePhrase("I want to work for Cox Automotive"); var expectedValue = "Automotive Cox for work to want I"; Assert.AreEqual(expectedValue, calculatedValue, "Value is incorrect"); }
static void Main(string[] args) { /// Class1.Test_1_isomorphic_samples(number_of_nodes) // Class1.Test_1_isomorphic_samples(500); // Class1.Test_1_isomorphic_samples(750); // Class1.Test_1_isomorphic_samples(1000); TestFunctions.Test_1_isomorphic_samples(); // Class1.Test_2_NOT_isomorphic_samples(250); // Class1.Test_2_NOT_isomorphic_samples(500); // Class1.Test_2_NOT_isomorphic_samples(750); // Class1.Test_2_NOT_isomorphic_samples(1000); // Class1.input_test_3 input_T3 = new Class1.input_test_3(); // input_T3.are_isomorphic = true; // input_T3.starting_number_of_nodes = 200; // input_T3.incresement_of_nodes = 0; // input_T3.repeatings_for_each_case =5; // input_T3.number_of_increasments = 5; // Class1.output_test_3 output_T3 = null; //Class1.Test_3(input_T3, out output_T3); // output_T3.print(); // Class1.Test_7(); TestFunctions.Test_4(); TestFunctions.Test_5(); TestFunctions.Test_6(); TestFunctions.Test_8(); TestFunctions.Test_Graph_Key_Dictionary(); }
// Create map for tests public static Map CreateTestMap() { Map map = TestFunctions.CreateClassObject <Map>("Assets/Prefabs/Map/Map.prefab"); map.Initialize(); return(map); }
public void SaveImage() { string path = @"C:\Tests\Smiley.png"; // Create substitutes for interfaces var filterRepository = Substitute.For <IFilterController>(); var edgeDetRepository = Substitute.For <IEdgeDetectionController>(); // Setup image controller imageController = new ImageController(filterRepository, edgeDetRepository); imageController.image = original; // Save image to disk imageController.SaveImage(path); // Load saved image imageController.LoadImage(path); // Get hash of saved and original image string originalHash = TestFunctions.GetImageHash(original); string testHash = TestFunctions.GetImageHash(imageController.image); // Comparison Assert.AreEqual(originalHash, testHash); }
private void Prepare(string inputPath, out StreamWriter output, string outputPath) { TestFunctions.InitStreamReader(out var input, inputPath); TestFunctions.InitStreamWriter(out output, outputPath); _compiler.Input = input; }
// Create game map public static GameMap CreateTestGameMap() { GameMap gameMap = TestFunctions.CreateClassObject <GameMap>("Assets/Prefabs/Map/Game Map.prefab"); gameMap.Initialize(); return(gameMap); }
// Create a player with a specific ID public static Player CreateTestPlayer(int playerId) { Vector3Int startTileCoords = new Vector3Int(-4, 4, 0); Player newPlayer = TestFunctions.CreateClassObject <Player>(ENV.PLAYER_PREFAB_FULL_PATH); newPlayer.InitializeObject(playerId, startTileCoords); return(newPlayer); }
public MainWindow() { InitializeComponent(); DataContext = this; Refresh(); InitializeNetwork(); test = TestFunctions.CreateVectorTest(bow); }
public void BuildTotalLeachFileTest() { string TemplateFile = @"D:\DK_information\TestData\FileStructure\DaisyLeaching\Eksempel_på_format_udvask_25102013.txt"; string ShapeGrid = @"D:\DK_information\TestData\FileStructure\DaisyLeaching\DKDomainNodes_LU_Soil_codes.shp"; string OutputDirectory = @"D:\DK_information\TestData\FileStructure\DaisyLeaching"; TestFunctions.BuildTotalLeachFile(TemplateFile, ShapeGrid, OutputDirectory); }
private void Run(ref StreamWriter output) { // _compiler.Parse(); // _compiler.PrintAst(output); _compiler.Output = output; TestFunctions.ParseAndPrint(ref _compiler, ref output); output.Close(); _compiler.Input.Close(); }
public void OutputItemTest() { // convert string to stream byte[] byteArray = Encoding.UTF8.GetBytes(contents); MemoryStream stream = new MemoryStream(byteArray); var result = TestFunctions.TestOutput(stream, new DataLakeStoreOutput()); Assert.Same(stream, result.FileStream); }
public void NamesAreUnique() { string[] names1 = { "Ava", "Emma", "Olivia" }; string[] names2 = { "Olivia", "Sophia", "Emma" }; string expectedValue = "Sophia, Olivia, Emma, Ava"; var calculatedValue = string.Join(", ", TestFunctions.UniqueNames(names1, names2)); Assert.AreEqual(expectedValue, calculatedValue, "Value is incorrect"); }
public void AverageIsCorrect_FourValues() { var calculatedValue = TestFunctions.Average(new List <int>() { 10, 11, 12, 13 }); var expectedValue = 11.5; Assert.AreEqual(expectedValue, calculatedValue, "Value is incorrect"); }
public async void GetCourses() { var dbContext = new Mock <ApplicationDbContext>(); dbContext.SetupGet(x => x.Courses).Returns(TestFunctions.GetDbSet <Course>(TestData.Courses).Object); var result = await CourseService.GetCourses(); Assert.NotNull(result); }
public void AverageIsCorrect_ThreeValues() { var calculatedValue = TestFunctions.Average(new List <int>() { 3, 2, 1 }); var expectedValue = 2; Assert.AreEqual(expectedValue, calculatedValue, "Value is incorrect"); }
public void ReturnsCallback_ThreeMatchingArgs_ReturnsResultFromCallback() { Smock.Run(context => { context .Setup(() => TestFunctions.ThreeArguments(1, 2, 3)) .Returns <int, int, int>((a, b, c) => a + b + c); Assert.AreEqual(6, TestFunctions.ThreeArguments(1, 2, 3)); }); }
public void ReturnsCallback_TooManyArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.OneArgument(1)) .Returns <int, int>((a, b) => 42); }); }); }
public void Callback_VoidMoreThanExpectedThirteenArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.VoidThirteenArguments(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) .Callback <int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, z) => { }); }); }); }
public void InitializeNetwork() { classes = DataClass.CreateDataClasses(bow); classes = TestFunctions.CreateFullSet(classes, bow); myVector x = new myVector(); { x = bow.GetVectorsList()[0]; WithoutHiddenLayerNetwork = NeuralConstruction.CreateDefaultNetwork(x.GetVector().Count, classes); NeuralConstruction.SampleWeight(WithoutHiddenLayerNetwork, bow.GetVectorsList(), classes); NeuralNetwork = NeuralConstruction.CreateNewDefaultNetwork(x.GetVector().Count, classes, 5); } }
public void Callback_MoreThanExpectedOneArgument_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.OneArgument(1)) .Callback <int, int>((a, z) => { }); }); }); }
public void ReturnsCallback_EightMatchingArgs_ReturnsResultFromCallback() { Smock.Run(context => { context .Setup(() => TestFunctions.EightArguments(1, 2, 3, 4, 5, 6, 7, 8)) .Returns <int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => a + b + c + d + e + f + g + h); var result = TestFunctions.EightArguments(1, 2, 3, 4, 5, 6, 7, 8); Assert.AreEqual(36, result); }); }
public void ReturnsCallback_SixMatchingArgs_ReturnsResultFromCallback() { Smock.Run(context => { context .Setup(() => TestFunctions.SixArguments(1, 2, 3, 4, 5, 6)) .Returns <int, int, int, int, int, int>((a, b, c, d, e, f) => a + b + c + d + e + f); var result = TestFunctions.SixArguments(1, 2, 3, 4, 5, 6); Assert.AreEqual(21, result); }); }
public void ReturnsCallback_TooFewArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.TwoArguments(1, 2)) .Returns <int>(a => 42); }); }); }
public void Callback_VoidLessThanExpectedTwoArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.VoidTwoArguments(1, 2)) .Callback <int>((a) => { }); }); }); }
public void Callback_LessThanExpectedTwelveArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.TwelveArguments(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) .Callback <int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { }); }); }); }
public void Callback_LessThanExpectedEightArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.EightArguments(1, 2, 3, 4, 5, 6, 7, 8)) .Callback <int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { }); }); }); }
static void Main(string[] args) { Console.WriteLine($"Printing the value: '{TestFunctions.SomeText}'"); Console.WriteLine("Now calling the function..."); TestFunctions.PrintSomeText(); Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadLine(); }
public void Callback_LessThanExpectedSixteenArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.SixteenArguments(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) .Callback <int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { }); }); }); }
public void ReturnsCallback_FourMatchingArgs_ReturnsResultFromCallback() { Smock.Run(context => { context .Setup(() => TestFunctions.FourArguments(1, 2, 3, 4)) .Returns <int, int, int, int>((a, b, c, d) => a + b + c + d); var result = TestFunctions.FourArguments(1, 2, 3, 4); Assert.AreEqual(10, result); }); }
public void Callback_MoreThanExpectedNineArguments_ThrowsException() { Assert.Throws <ArgumentException>(() => { Smock.Run(context => { context .Setup(() => TestFunctions.NineArguments(1, 2, 3, 4, 5, 6, 7, 8, 9)) .Callback <int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, z) => { }); }); }); }
private void NextIndividuals() { int count = NumberOfIndividuals; if (bestIndividual != null) { count = NumberOfIndividuals - 1; bestIndividual.Id = count; Individuals.Add(bestIndividual); //UpdatePoints(count, bestIndividual); //points.Positions.Update(count, 1, new float[] { bestIndividual.X, bestIndividual.Y, bestIndividual.Z }); } Random random = new Random(); for (int i = 0; i < count; i++) { var x = (float)NextDouble(random, newXmin, newXmax); var y = (float)NextDouble(random, newYmin, newYmax); if (OnlyIntegers) { x = (float)Math.Round(x); y = (float)Math.Round(y); } TestFunctions testFunctions = new TestFunctions(); var z = RealizeMethod(new double[] { x, y }); Individual individual = new Individual { Id = i, X = x, Y = y, Z = z }; Individuals.Add(individual); //UpdatePoints(i, individual); //points.Positions.Update(i, 1, new float[] { individual.X, individual.Y, individual.Z }); } }
public void TestShot() { TestFunctions tester = new TestFunctions(); float result = tester.ShootGun(10, 1); Assert.AreEqual(9, result); }
public void TestReload() { TestFunctions tester = new TestFunctions(); float result = tester.ReloadGun(0, 20); Assert.AreEqual(10, result); }
public ValuesController(TestFunctions testFunctions) { _testFunctions = testFunctions; }