示例#1
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);
            }
        }
示例#2
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);
            }
        }
示例#3
0
        public void Can_Start_Tester()
        {
            using (var req = MvcMockHelpers.SimulateRequest("http://localhost/Test.aspx"))
            {
                ABTester.Start();

                Assert.IsNotNull(ABTester.Current);
            }
        }
示例#4
0
        public void Can_Ouput_Test()
        {
            using (var req = MvcMockHelpers.SimulateRequest("http://localhost/Test.aspx"))
            {
                ABTester.Start();

                Assert.IsNotNull(ABTester.Current);

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

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

                Assert.IsTrue(output == option1 || output == option2);
            }
        }
示例#5
0
        public void Can_Ouput_Test_With_Five_Options()
        {
            using (var req = MvcMockHelpers.SimulateRequest("http://localhost/Test.aspx"))
            {
                ABTester.Start();

                Assert.IsNotNull(ABTester.Current);

                var option1 = "one";
                var option2 = "two";
                var option3 = "three";
                var option4 = "four";
                var option5 = "five";

                var output = ABTester.Test("Can_Ouput_Test_With_Five_Options", option1, option2, option3, option4, option5);

                var options = new List <string> {
                    option1, option2, option3, option4, option5
                };

                Assert.IsTrue(options.Contains(output));
            }
        }
示例#6
0
        public void Can_Run_Test_And_Get_Active_Tests()
        {
            using (var req = MvcMockHelpers.SimulateRequest("http://localhost/Test.aspx"))
            {
                ABTester.Start();

                Assert.IsNotNull(ABTester.Current);

                var testname = "Can_Run_Test_And_Get_Active_Tests";

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

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

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

                var results = ABTester.Settings.Storage.GetActiveTests();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Count > 0);
            }
        }
示例#7
0
 protected void Application_BeginRequest()
 {
     ABTester.Start();
 }
示例#8
0
        //
        // GET: /Home/

        public ActionResult Index()
        {
            ABTester.Start();
            return(View());
        }