Exemplo n.º 1
0
        public void TestPrivates()
        {
            // Note how we test internal method with InternalsVisibleTo
            // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/assemblies-gac/friend-assemblies
            var po = new SomeBusinessLogicClass();

            Assert.AreEqual(3, po.SomeInternalLogic(1, 2));

            Assert.AreEqual(42, SomeBusinessLogicClass.SomeInternalStaticLogic());
        }
Exemplo n.º 2
0
        public void DataDrivenTest(string valueAsString)
        {
            // Don't forget to set a breakpoint in this method and
            //   watch how the test method is called multiple times.

            var objectToTest = new SomeBusinessLogicClass();

            var number = Convert.ToInt32(valueAsString);

            Assert.AreEqual(number * number, objectToTest.Square(number));
        }
Exemplo n.º 3
0
        /*[DataSource("System.Data.SqlServerCe.4.0", "Data Source=TestData.sdf;", "TestValues", DataAccessMethod.Sequential)]
         * [DeploymentItem("TestData.sdf")]
         * [TestMethod]*/
        public void DataDrivenTest()
        {
            // Don't forget to set a breakpoint in this method and
            //   inspect this.TestContext and watch how the test method
            //   is called multiple times depending on the content
            //   of the data source.

            var objectToTest = new SomeBusinessLogicClass();

            var number = Convert.ToInt32(this.TestContext.DataRow["Value"]);

            Assert.AreEqual(number * number, objectToTest.Square(number));
        }