示例#1
0
        public void Can_Convert_Test_With_Results()
        {
            using (var req = MvcMockHelpers.SimulateRequest("http://localhost/Test.aspx"))
            {
                ABTester.Start();

                Assert.IsNotNull(ABTester.Current);

                var testname = "Can_Convert_Test_With_Results";

                var option1 = "one";
                var option2 = "two";

                var output = ABTester.Test(testname, option1, option2);

                Assert.IsTrue(output == option1 || output == option2);

                ABTester.Convert(testname);

                var results = ABTester.GetResults(testname);

                Assert.IsNotNull(results);
                Assert.AreEqual(1, results.Count);
                Assert.IsTrue(results[0].Converted);
            }
        }
示例#2
0
        public void Can_Run_Two_Tests_And_Convert_One()
        {
            using (var req = MvcMockHelpers.SimulateRequest("http://localhost/Test.aspx"))
            {
                ABTester.Start();

                Assert.IsNotNull(ABTester.Current);

                var testname = "Can_Run_Two_Tests_And_Convert_One";

                var option1 = "one";
                var option2 = "two";

                var output = ABTester.Test(testname, option1, option2);

                Assert.IsTrue(output == option1 || output == option2);

                //Call Start again to similate next request with new ABTester instance
                ABTester.Start();

                var output2 = ABTester.Test(testname, option1, option2);

                Assert.IsTrue(output2 == option1 || output2 == option2);

                ABTester.Convert(testname);

                var results = ABTester.GetResults(testname);

                Assert.IsNotNull(results);
                Assert.AreEqual(2, results.Count);
                Assert.IsFalse(results[0].Converted);
                Assert.IsTrue(results[1].Converted);
            }
        }
示例#3
0
        public ActionResult ConvertTest3()
        {
            //Tell the ABTester this was the "downloaded" event
            ABTester.Convert("exampletest3");

            return(RedirectToAction("Results"));
        }