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");
        }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
        // Create map for tests
        public static Map CreateTestMap()
        {
            Map map = TestFunctions.CreateClassObject <Map>("Assets/Prefabs/Map/Map.prefab");

            map.Initialize();
            return(map);
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 6
0
        // Create game map
        public static GameMap CreateTestGameMap()
        {
            GameMap gameMap = TestFunctions.CreateClassObject <GameMap>("Assets/Prefabs/Map/Game Map.prefab");

            gameMap.Initialize();
            return(gameMap);
        }
Exemplo n.º 7
0
        // 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);
        }
Exemplo n.º 8
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = this;
     Refresh();
     InitializeNetwork();
     test = TestFunctions.CreateVectorTest(bow);
 }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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();
        }
Exemplo n.º 11
0
        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");
        }
Exemplo n.º 14
0
        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");
        }
Exemplo n.º 16
0
        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));
            });
        }
Exemplo n.º 17
0
 public void ReturnsCallback_TooManyArguments_ThrowsException()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         Smock.Run(context =>
         {
             context
             .Setup(() => TestFunctions.OneArgument(1))
             .Returns <int, int>((a, b) => 42);
         });
     });
 }
Exemplo n.º 18
0
 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) => { });
         });
     });
 }
Exemplo n.º 19
0
 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);
     }
 }
Exemplo n.º 20
0
 public void Callback_MoreThanExpectedOneArgument_ThrowsException()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         Smock.Run(context =>
         {
             context
             .Setup(() => TestFunctions.OneArgument(1))
             .Callback <int, int>((a, z) => { });
         });
     });
 }
Exemplo n.º 21
0
        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);
            });
        }
Exemplo n.º 22
0
        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);
            });
        }
Exemplo n.º 23
0
 public void ReturnsCallback_TooFewArguments_ThrowsException()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         Smock.Run(context =>
         {
             context
             .Setup(() => TestFunctions.TwoArguments(1, 2))
             .Returns <int>(a => 42);
         });
     });
 }
Exemplo n.º 24
0
 public void Callback_VoidLessThanExpectedTwoArguments_ThrowsException()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         Smock.Run(context =>
         {
             context
             .Setup(() => TestFunctions.VoidTwoArguments(1, 2))
             .Callback <int>((a) => { });
         });
     });
 }
Exemplo n.º 25
0
 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) => { });
         });
     });
 }
Exemplo n.º 26
0
 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) => { });
         });
     });
 }
Exemplo n.º 27
0
        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();
        }
Exemplo n.º 28
0
 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) => { });
         });
     });
 }
Exemplo n.º 29
0
        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);
            });
        }
Exemplo n.º 30
0
 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) => { });
         });
     });
 }
Exemplo n.º 31
0
        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 });
            }
        }
Exemplo n.º 32
0
 public void TestShot()
 {
     TestFunctions tester = new TestFunctions();
     float result = tester.ShootGun(10, 1);
     Assert.AreEqual(9, result);
 }
Exemplo n.º 33
0
 public void TestReload()
 {
     TestFunctions tester = new TestFunctions();
     float result = tester.ReloadGun(0, 20);
     Assert.AreEqual(10, result);
 }
Exemplo n.º 34
0
 public ValuesController(TestFunctions testFunctions)
 {
     _testFunctions = testFunctions;
 }