Esempio n. 1
0
        public void ExceptionsTest()
        {
            TestingClass.Process(path + "/ExceptionTests");
            var successCount = TestingClass.TestInformation.Where(x => !x.Crashed).ToList().Count;

            Assert.AreEqual(4, successCount);
        }
Esempio n. 2
0
        public void ParametersTest()
        {
            TestingClass.Process(path + "/ParametersTests/bin");
            var successTests = TestingClass.TestInformation.Where(x => !x.Crashed).ToList();

            Assert.AreEqual(1, successTests.Count);
        }
Esempio n. 3
0
        public void SuccessfulTestingTest()
        {
            TestingClass.Process(path + "/SuccessfulTesting");
            var successCount = TestingClass.TestInformation.Where(x => x.Crashed == false).ToList().Count;

            Assert.AreEqual(4, successCount);
        }
Esempio n. 4
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (lbCalsses.Items.Count == 0)
            {
                MessageBox.Show("Please Load an Assembly With At Least One Class");
            }
            var selectedUnitTests = new List <UnitTest>();

            foreach (TableLayoutPanel tablePanel in flowLayoutPanel1.Controls)
            {
                foreach (Control control in tablePanel.Controls)
                {
                    if (control is CheckBox && ((CheckBox)control).CheckState == CheckState.Checked && control.Name.Contains("_AddUnitTest"))
                    {
                        var injectCode     = control.Parent.Controls.Where(c => c.Name.Contains("InjectCode")) as CheckBox;
                        var mockParameters = control.Parent.Controls.Where(c => c.Name.Contains("MockAll")) as CheckBox;
                        var unitTest       = tablePanel.Tag as UnitTest;
                        unitTest.InjectCode = injectCode.Checked;
                        unitTest.InjectCode = mockParameters.Checked;
                        selectedUnitTests.Add(unitTest);
                    }
                }
            }

            var testingClass = new TestingClass()
            {
                ClassName = lbCalsses.SelectedItem.ToString() + "Testing", InjectedCode = InjectedCode, UnitTests = selectedUnitTests, OutputLocation = lblOutputLocation.Text
            };

            mainFormOpreation.Generate(testingClass);
            MessageBox.Show("File Generated Succefully at " + lblOutputLocation.Text);
        }
Esempio n. 5
0
        public void Generate(TestingClass testingClass)
        {
            var template = new TestingClassTemplate(testingClass);

            testingClass.OutputLocation = testingClass.OutputLocation.Contains(".") ? testingClass.OutputLocation : testingClass.OutputLocation + testingClass.ClassName + "Testing";
            File.WriteAllText(testingClass.OutputLocation, template.TransformText());
        }
Esempio n. 6
0
        public void IgnoreAttributeTest()
        {
            TestingClass.Process(path + "/IgnoreAttributeTest");
            var ignoredTests = TestingClass.TestInformation.Where(x => !x.Ignored).ToList();

            Assert.IsTrue(ignoredTests.Where(x => (x.IgnoreReason).CompareTo("TestCase") == 0) != null);
            Assert.IsTrue(ignoredTests.Where(x => (x.IgnoreReason).CompareTo("SecondTestCase") == 0) != null);
        }
Esempio n. 7
0
    private static bool MultiModule()
    {
        //return true;
        TestingClass            testingClass            = new TestingClass(1);
        TestingClassInNamespace testingClassInNamespace = new TestingClassInNamespace(2);

        TestingClassInNamespace.TestingClassNested testingClassNested = new TestingClassInNamespace.TestingClassNested(3);
        return(testingClass.GetN() == 1 && testingClassInNamespace.GetN() == 2 && testingClassNested.GetN() == 3);
    }
Esempio n. 8
0
    public void PaddingTest()
    {
        var testingClass = new TestingClass
        {
            Field1 = new byte[] { 0x01 },
            Field2 = new byte[] { 0x99, 0x98, 0x97, 0x96, 0x95, 0x94 }
        };

        Roundtrip(testingClass, new byte[] { 0x01, 0x00, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94 });
    }
Esempio n. 9
0
        // [InlineData("FizzBuzzBaz", 35)]
        public void FizzBuzzBazz(string expected, int num)
        {
            //ARRANGE

            var sut = new TestingClass();
            //ACT

            var actual = sut.FizzBuzzBaz(num);


            //ASSERT
            Assert.Equal(expected, actual);
        }
Esempio n. 10
0
        //[Theory]
        //[InlineData(212, 100)]
        public void CtoF(int expected, int temp)
        {
            //ARRANGE

            var sut = new TestingClass();
            //ACT

            var actual = sut.FahrenheitConvert(temp);


            //ASSERT
            Assert.Equal(expected, actual);
        }
        public void AJson_JsonBuilding_CreatingJson_UsingNullValues()
        {
            var test = new TestingClass();

            test.NumberValue = 2;
            test.ObjectValue = null;
            Json json = JsonHelper.BuildJsonForObject(test, m_testSettings);
            var  doc  = json.Data as JsonDocument;

            Assert.IsNotNull(doc);
            Assert.AreEqual(1, doc.Count);

            Assert.AreEqual("NumberValue", doc.KeyAt(0));
            Assert.IsTrue(doc.ValueAt(0).IsValue);
            Assert.AreEqual("2", doc.ValueAt(0).StringValue);
        }
Esempio n. 12
0
 public void TPAReadKeyFromKeyboardBufferAsyncTest()
 {
     using (Producer <TestingClass> _producer = new Producer <TestingClass>(new ProductFactory()))
     {
         List <TestingClass> _products = new List <TestingClass>();
         long _counter = 0;
         for (int i = 0; i < 3; i++)
         {
             Task <TestingClass> _workToDo = _producer.TPAReadKeyFromKeyboardBufferAsync();
             while (_workToDo.Status != TaskStatus.RanToCompletion)
             {
                 _counter++;
             }
             TestingClass _lastChar = _workToDo.Result;
             _products.Add(_lastChar);
         }
         Assert.AreEqual <int>(3, _products.Count);
         Assert.IsTrue(_counter > 1000000);
     }
 }
Esempio n. 13
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("USAGE:");
                Console.WriteLine("mono TestingApplication.exe -bulk <input file> <dest1> ... <dstN> -q <src1> <dst1> ... <srcN> <dstN>");
                Console.WriteLine("mono TestingApplication.exe -serverPORT <input file> <precomp file> <cache file>");
                Console.WriteLine("mono TestingApplication.exe -cmd");
                return;
            }

            if ("-cmd" == args[0])
            {
                TestingClass test = new TestingClass();
                test.CLI(false);
                return;
            }

            // Graph initialization
            //NetworkGraph g = new NetworkGraph();

            // E.g., input Cyclops_caida.txt
            if (File.Exists(args[1]))
            {
                InputFileReader iFR = new InputFileReader(args[1], g);
                iFR.ProcessFile();
                Int32 p2pEdges = 0;
                Int32 c2pEdges = 0;
                foreach (var ASNode in g.GetAllNodes())
                {
                    p2pEdges += ASNode.GetNeighborTypeCount(RelationshipType.PeerOf);
                    c2pEdges += ASNode.GetNeighborTypeCount(RelationshipType.CustomerOf);
                    c2pEdges += ASNode.GetNeighborTypeCount(RelationshipType.ProviderTo);
                }

                //Console.WriteLine("Read in the graph, it has " + g.NodeCount + " nodes and " + g.EdgeCount + " edges.");
                //Console.WriteLine("P2P: " + p2pEdges + " C2P: " + c2pEdges);
            }
            else
            {
                Console.WriteLine("The file " + args[1] + " does not exist.");
                return;
            }

            if ("-bulk" == args[0])
            {
                // Setting destinations
                //HashSet<string> dests = new HashSet<string>();
                //List<Destination> d = new List<Destination>();

                int i = 1;
                for (i = 1; i < args.Length; ++i)
                {
                    if ("-q" == args[i])
                    {
                        break;
                    }
                    if (dests.Contains(args[i]))
                    {
                        continue;
                    }
                    dests.Add(args[i]);

                    Destination newD = new Destination();
                    if (initDestination(ref g, ref newD, args[i]))
                    {
                        d.Add(args[i], newD);
                        Console.WriteLine("Initialized and added " + newD.destination);
                    }
                }

                Console.WriteLine("DESTS " + dests.Count);

                // Approaching queries
                for (i = i + 1; i < args.Length; i += 2)
                {
                    //StringBuilder res = new StringBuilder();
                    //int l = getPath(ref d, args[i], args[i+1]);
                    //getAllPathsOfLength(ref d, l, args[i], args[i+1], ref res);

                    List <List <UInt32> > allPaths = new List <List <UInt32> >();

                    if (d.ContainsKey(args[i + 1]))
                    {
                        UInt32 src;
                        UInt32 dst;
                        if (UInt32.TryParse(args[i], out src) && UInt32.TryParse(args[i + 1], out dst))
                        {
                            Console.WriteLine("ASes from " + src + " to " + dst);
                            d[args[i + 1]].GetAllBestPaths(src, dst, ref allPaths);
                        }
                    }

                    foreach (List <UInt32> path in allPaths)
                    {
                        for (int j = 0; j < path.Count; ++j)
                        {
                            Console.WriteLine(path[j]);
                        }
                        Console.WriteLine("-");
                    }
                }

                return;
            }

            if (args[0].StartsWith("-server"))
            {
                if (args.Length > 2)
                {
                    loadPrecomputation(args[2]);
                    cacheDestinations(args[3]);
                }

                String port = args[0].Replace("-server", "");
                StartListening(port);
            }
        }
Esempio n. 14
0
 public TestingClassTemplate(TestingClass testingClass)
 {
     _testingClass = testingClass;
 }
Esempio n. 15
0
 public void EmptyTestsTest()
 {
     TestingClass.Process(path + "/EmptyTests");
     Assert.AreEqual(4, TestingClass.TestInformation.Count);
 }
Esempio n. 16
0
 public void Generate(TestingClass testingClass)
 {
     templateService.Generate(testingClass);
 }