Inheritance: MockWebPage
コード例 #1
0
        private bool ensureTimingWorksGet(Tracker t, MockGet g, bool expectB64 = true)
        {
            if (!expectB64)
            {
                Assert.Fail("non b64 mode not supported");
            }

            t.Track(new Timing().SetCategory("category").SetVariable("variable").SetTiming(5).SetLabel("label").Build());
            t.Flush();

            var actual = g.Queries[0];

            var expectedJsonString = @"{""schema"":""iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0"",""data"":{""schema"":""iglu:com.snowplowanalytics.snowplow/timing/jsonschema/1-0-0"",""data"":{""category"":""category"",""label"":""label"",""timing"":5,""variable"":""variable""}}}";
            var expectedB64        = Convert.ToBase64String(Encoding.UTF8.GetBytes(expectedJsonString));

            var expected = new Dictionary <string, string>
            {
                { "e", "ue" },
                { "ue_px", expectedB64 }
            };

            assertQueryContainsDefaults(actual);
            assertQueryContainsAll(actual, expected);

            return(true);
        }
コード例 #2
0
        public void testSendGetRequestNon200ResponseHttps()
        {
            var getReq = new MockGet()
            {
                StatusCode = 500
            };
            var endpoint = new SnowplowHttpCollectorEndpoint("somewhere.com", HttpProtocol.HTTPS, getMethod: new GetDelegate(getReq.HttpGet));
            var payload  = new Payload();

            payload.Add("hello", "world");
            payload.Add("ts", "123");

            var sendList = new List <Tuple <string, Payload> >();

            sendList.Add(Tuple.Create("0", payload));

            var sendResult = endpoint.Send(sendList);

            Assert.IsTrue(sendResult.FailureIds.Count == 1);
            Assert.IsTrue(getReq.Queries.Count == 1);

            var actual        = getReq.Queries[0];
            var expectedRegex = new Regex("https://somewhere\\.com/i\\?hello=world&ts=123&stm=[0-9]{13}");

            Assert.IsTrue(expectedRegex.Match(actual).Success, String.Format("{0} doesn't match {1}", actual, expectedRegex.ToString()));
        }
コード例 #3
0
    public void Edit_Wrong_Id_Shoud_Goto_Create()
    {
        dynamic page = new MockGet(new string[] { "Pages", "Edit", "id" });

        Mvc.Run(page, new PageController());
        Assert.AreEqual("~/Pages/Create", page.Page.Redirect);
    }
コード例 #4
0
    public void Default_Post()
    {
        dynamic page = new MockGet(new string[] { "/" });

        Mvc.Run(page, new PageController());
        Assert_ShowDefaultPage(page);
    }
コード例 #5
0
        private bool ensureScreenViewWorksGet(Tracker t, MockGet g, bool expectB64 = true)
        {
            if (!expectB64)
            {
                Assert.Fail("non b64 mode not supported");
            }

            t.Track(new ScreenView().SetName("entry screen").SetId("0001").Build());
            t.Flush();

            var actual = g.Queries[0];

            var expectedJsonString = @"{""schema"":""iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0"",""data"":{""schema"":""iglu:com.snowplowanalytics.snowplow/screen_view/jsonschema/1-0-0"",""data"":{""name"":""entry screen"",""id"":""0001""}}}";
            var expectedB64        = Convert.ToBase64String(Encoding.UTF8.GetBytes(expectedJsonString));

            var expected = new Dictionary <string, string>
            {
                { "e", "ue" },
                { "ue_px", expectedB64 }
            };

            assertQueryContainsDefaults(actual);
            assertQueryContainsAll(actual, expected);

            return(true);
        }
コード例 #6
0
        private bool ensureStructEventsWorkGet(Tracker t, MockGet g)
        {
            t.Track(new Structured()
                    .SetCategory("myCategory")
                    .SetAction("myAction")
                    .SetLabel("myLabel")
                    .SetProperty("myProperty")
                    .SetValue(17)
                    .Build());
            t.Flush();

            var expectedRegex = new Regex(
                String.Format(@"http://snowplowanalytics.com/i\?e=se&se_ca={0}&se_ac={1}&se_la={2}&se_pr={3}&se_va={4}&eid=[^&]+&dtm=[^&]+&tv=[^&]+&tna=testNamespace&aid=testAppId&p=pc",
                              Regex.Escape(WebUtility.UrlEncode("myCategory")),
                              Regex.Escape(WebUtility.UrlEncode("myAction")),
                              Regex.Escape(WebUtility.UrlEncode("myLabel")),
                              Regex.Escape(WebUtility.UrlEncode("myProperty")),
                              Regex.Escape(WebUtility.UrlEncode("17"))
                              )
                );

            var actual = g.Queries[0];

            Assert.IsTrue(expectedRegex.Match(actual).Success, String.Format("{0} doesn't match regex {1}", actual, expectedRegex.ToString()));

            return(true);
        }
コード例 #7
0
    [ExpectedException(typeof(Exception))] //delete through GET should not be allowed
    public void Get_Delete()
    {
        dynamic webPage    = new MockGet(new string[] { "Mock", "Delete", "y", "z" });
        dynamic controller = new MockController();

        Mvc.Run(webPage, controller);
        controller.Verify();
    }
コード例 #8
0
    public void Routing_Get()
    {
        dynamic webPage    = new MockGet(new string[] { "Mock", "a", "1", "2" });
        dynamic controller = new MockController();

        Mvc.Run(webPage, controller);
        Assert.IsTrue(controller.Get_Called);
        controller.Verify();
    }
コード例 #9
0
ファイル: PageControllerTest.cs プロジェクト: yysun/Rabbit
    public void Create_Get()
    {
        dynamic page = new MockGet(new string[] { "Pages", "Create", "id" });
        Mvc.Run(page, new PageController());

        Assert.AreEqual("~/Views/Pages/_Page_Create.cshtml", page.Page.View);
        Assert.IsTrue(page.Page.Model.Id == null);
        Assert.AreEqual("[New Page]", page.Page.Model.Title);
    }
コード例 #10
0
    public void Get_Edit_Pass_String()
    {
        dynamic webPage    = new MockGet(new string[] { "Mock", "Edit", "y", "z" });
        dynamic controller = new MockController();

        Mvc.Run(webPage, controller);
        Assert.AreEqual("y/z", controller.Id);
        controller.Verify();
    }
コード例 #11
0
    public void Create_Get()
    {
        dynamic page = new MockGet(new string[] { "Pages", "Create", "id" });

        Mvc.Run(page, new PageController());

        Assert.AreEqual("~/Views/Pages/_Page_Create.cshtml", page.Page.View);
        Assert.IsTrue(page.Page.Model.Id == null);
        Assert.AreEqual("[New Page]", page.Page.Model.Title);
    }
コード例 #12
0
ファイル: ControllerTest.cs プロジェクト: yysun/Rabbit
    public void RenderView_Should_Get_Calling_Function_Name_As_View()
    {
        var webPage = new MockGet(new string[] { "Test", "List" });

        var controller = new TestController();
        Mvc.Run(webPage, controller);

        Assert.AreEqual("~/Views//__List.cshtml", webPage.Page.View);

        webPage.Verify();
    }
コード例 #13
0
    public void Routing_All()
    {
        dynamic webPage    = new MockGet(new string[] { "Mock", "x", "y", "z" });
        dynamic controller = new MockController();

        Mvc.Run(webPage, controller);
        Assert.IsTrue(controller.All_Called);
        Assert.AreEqual("y", controller.UrlData[1]);
        Assert.AreEqual("z", controller.UrlData[2]);
        controller.Verify();
    }
コード例 #14
0
ファイル: ControllerTest.cs プロジェクト: kouweizhong/Rabbit
    public void RenderView_Should_Get_Calling_Function_Name_As_View()
    {
        var webPage = new MockGet(new string[] { "Test", "List" });

        var controller = new TestController();

        Mvc.Run(webPage, controller);

        Assert.AreEqual("~/Views//__List.cshtml", webPage.Page.View);

        webPage.Verify();
    }
コード例 #15
0
        private bool ensureSettersWorkGet(Tracker t, MockGet g)
        {
            t.SetPlatform(Platform.Mob);
            t.SetUserId("malcolm");
            t.SetScreenResolution(100, 200);
            t.SetViewport(50, 60);
            t.SetColorDepth(24);
            t.SetTimezone("Europe London");
            t.SetLang("en");

            t.Track(new PageView()
                    .SetPageUrl("http://www.example.com")
                    .SetPageTitle("title page")
                    .SetReferrer("http://www.referrer.com")
                    .SetTrueTimestamp(1000000000000)
                    .Build());
            t.Flush();

            var actual = g.Queries[0];

            var expected = new Dictionary <string, string>
            {
                { "e", "pv" },
                { "url", "http://www.example.com" },
                { "page", "title page" },
                { "refr", "http://www.referrer.com" },
                { "tv", Version.VERSION },
                { "tna", "testNamespace" },
                { "aid", "testAppId" },
                { "p", "mob" },
                { "res", "100x200" },
                { "vp", "50x60" },
                { "cd", "24" },
                { "tz", "Europe London" },
                { "lang", "en" },
                { "ttm", "1000000000000" }
            };

            foreach (var k in expected.Keys)
            {
                var matcher = new Regex("[&?]" + k + "=(?<value>[^&]+)");
                var match   = matcher.Match(actual);

                Assert.IsTrue(match.Success, "Couldn't find key " + k + " in query " + actual);

                var    found   = match.Result("${value}");
                string decoded = WebUtility.UrlDecode(found);

                Assert.AreEqual(expected[k], decoded, "key " + k + " has the wrong value " + decoded);
            }

            return(true);
        }
コード例 #16
0
        private bool ensureContextsWorkGet(Tracker t, MockGet g, bool useb64 = true)
        {
            Assert.IsTrue(useb64);

            var pageContext = new GenericContext()
                              .SetSchema("iglu:com.snowplowanalytics.snowplow/page/jsonschema/1-0-0")
                              .Add("type", "test")
                              .Add("public", false)
                              .Build();

            var userContext = new GenericContext()
                              .SetSchema("iglu:com.snowplowanalytics.snowplow/user/jsonschema/1-0-0")
                              .Add("age", 40)
                              .Add("name", "ned")
                              .Build();

            var contexts = new List <IContext>
            {
                pageContext,
                userContext
            };

            t.Track(new PageView().SetPageUrl("http://www.example.com").SetCustomContext(contexts).Build());
            t.Flush();

            var actual = g.Queries[0];

            var expected = new Dictionary <string, string>
            {
                { "e", "pv" },
                { "url", "http://www.example.com" }
            };

            var expectedJsonString = @"{""schema"":""iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-1"",""data"":[{""schema"":""iglu:com.snowplowanalytics.snowplow/page/jsonschema/1-0-0"",""data"":{""type"":""test"",""public"":false}},{""schema"":""iglu:com.snowplowanalytics.snowplow/user/jsonschema/1-0-0"",""data"":{""age"":40,""name"":""ned""}}]}";
            var expectedB64        = Convert.ToBase64String(Encoding.UTF8.GetBytes(expectedJsonString));

            var extractCx = new Regex("cx=(?<cx>[^&]+)");

            Assert.IsTrue(extractCx.IsMatch(actual), "couldn't find cx in query");

            var match = extractCx.Match(actual);

            Assert.IsTrue(match.Success);

            var actualCx = match.Result("${cx}");

            Assert.AreEqual(expectedB64, actualCx);

            return(true);
        }
コード例 #17
0
    public void List_Should_Use_PageSize()
    {
        dynamic model = new Mock();

        model.Setup("List", new object[] { 5, 30 }, model);
        model.SetupGet("Value", new ExpandoObject());

        dynamic page       = new MockGet(new string[] { "Pages", "List", "5", "30" });
        var     controller = new PageController();

        controller.Model = model;
        Mvc.Run(page, controller);
        Assert.AreEqual("~/Views/Pages/_Page_List.cshtml", page.Page.View);
        model.Verify();
    }
コード例 #18
0
        public void testTracker()
        {
            var storage = new LiteDBStorage(_testDbFilename);

            Assert.AreEqual(0, storage.TotalItems);

            var queue = new PersistentBlockingQueue(storage, new PayloadToJsonString());

            var getRequestMock  = new MockGet();
            var postRequestMock = new MockPost();

            var endpoint = new SnowplowHttpCollectorEndpoint("snowplowanalytics.com",
                                                             postMethod: new SnowplowHttpCollectorEndpoint.PostDelegate(postRequestMock.HttpPost),
                                                             getMethod: new SnowplowHttpCollectorEndpoint.GetDelegate(getRequestMock.HttpGet));

            Assert.IsFalse(tracker.Started);

            tracker.Start(new AsyncEmitter(endpoint, queue, sendLimit: 1), trackerNamespace: "testNamespace", appId: "testAppId", encodeBase64: false);

            Assert.IsTrue(tracker.Started);
            Assert.IsTrue(ensureSubjectSet(tracker));
            Assert.IsTrue(ensurePageViewsWorkGet(tracker, getRequestMock));
            Assert.IsTrue(ensureStructEventsWorkGet(tracker, getRequestMock));
            Assert.IsTrue(ensureEcommerceTransactionWorksGet(tracker, getRequestMock));
            Assert.IsTrue(ensureUnstructEventGet(tracker, getRequestMock));

            tracker.Stop();

            Assert.IsFalse(tracker.Started);

            // Restart with base64 on
            tracker.Start(new AsyncEmitter(endpoint, queue, sendLimit: 1), trackerNamespace: "testNamespace", appId: "testAppId", encodeBase64: true);

            Assert.IsTrue(tracker.Started);
            Assert.IsTrue(ensureUnstructEventGet(tracker, getRequestMock, true));
            Assert.IsTrue(ensureScreenViewWorksGet(tracker, getRequestMock, true));
            Assert.IsTrue(ensureTimingWorksGet(tracker, getRequestMock, true));
            Assert.IsTrue(ensureContextsWorkGet(tracker, getRequestMock, true));
            Assert.IsTrue(ensureSettersWorkGet(tracker, getRequestMock));

            tracker.Stop();

            Assert.IsFalse(tracker.Started);
        }
コード例 #19
0
    public void Edit_Get()
    {
        dynamic data = new ExpandoObject();

        data.Id = "id";
        dynamic model = new Mock();

        model.Setup("Load", new object[] { It.Is <dynamic>(item => item.Id == "id") }, model);
        model.SetupGet("Value", data);

        dynamic page       = new MockGet(new string[] { "Pages", "Edit", "id" });
        var     controller = new PageController();

        controller.Model = model;

        Mvc.Run(page, controller);
        var view = SiteEngine.RunHook("GET_Pages_Page_Edit_View", page.Page.View) as string;

        Assert.AreEqual(view, page.Page.View);
        Assert.AreEqual("id", page.Page.Model.Id);
        model.Verify();
    }
コード例 #20
0
        public void testGetIgnoreSchemePathQueryInUri()
        {
            var getReq   = new MockGet();
            var endpoint = new SnowplowHttpCollectorEndpoint("something://somewhere.com/things?1=1", HttpProtocol.HTTPS, getMethod: new GetDelegate(getReq.HttpGet));
            var payload  = new Payload();

            payload.Add("sample", "value");

            var sendList = new List <Tuple <string, Payload> >();

            sendList.Add(Tuple.Create("0", payload));

            var sendResult = endpoint.Send(sendList);

            Assert.IsTrue(sendResult.SuccessIds.Count == 1);
            Assert.IsTrue(getReq.Queries.Count == 1);

            var actual        = getReq.Queries[0];
            var expectedRegex = new Regex("https://somewhere\\.com/i\\?sample=value&stm=[0-9]{13}");

            Assert.IsTrue(expectedRegex.Match(actual).Success, String.Format("{0} doesn't match {1}", actual, expectedRegex.ToString()));
        }
コード例 #21
0
        public void testGetPortIsSet()
        {
            var getReq   = new MockGet();
            var endpoint = new SnowplowHttpCollectorEndpoint("somewhere.com", HttpProtocol.HTTPS, getMethod: new GetDelegate(getReq.HttpGet), port: 999);
            var payload  = new Payload();

            payload.Add("foo", "bar");

            var sendList = new List <Tuple <string, Payload> >();

            sendList.Add(Tuple.Create("0", payload));

            var sendResult = endpoint.Send(sendList);

            Assert.IsTrue(sendResult.SuccessIds.Count == 1);
            Assert.IsTrue(getReq.Queries.Count == 1);

            var actual        = getReq.Queries[0];
            var expectedRegex = new Regex("https://somewhere\\.com:999/i\\?foo=bar&stm=[0-9]{13}");

            Assert.IsTrue(expectedRegex.Match(actual).Success, String.Format("{0} doesn't match {1}", actual, expectedRegex.ToString()));
        }
コード例 #22
0
        // --- Event testers

        private bool ensurePageViewsWorkGet(Tracker t, MockGet g)
        {
            t.Track(new PageView()
                    .SetPageUrl("http://www.example.com")
                    .SetReferrer("http://www.referrer.com")
                    .SetPageTitle("title page")
                    .Build());
            t.Flush();

            var expectedRegex = new Regex(
                String.Format(@"http://snowplowanalytics.com/i\?e=pv&url={0}&page={1}&refr={2}&eid=[^&]+&dtm=[^&]+&tv=[^&]+&tna=testNamespace&aid=testAppId&p=pc",
                              Regex.Escape(WebUtility.UrlEncode("http://www.example.com")),
                              Regex.Escape(WebUtility.UrlEncode("title page")),
                              Regex.Escape(WebUtility.UrlEncode("http://www.referrer.com"))
                              )
                );

            var actual = g.Queries[0];

            Assert.IsTrue(Uri.IsWellFormedUriString(actual, UriKind.Absolute));
            Assert.IsTrue(expectedRegex.Match(actual).Success, String.Format("{0} doesn't match {1}", actual, expectedRegex.ToString()));

            return(true);
        }
コード例 #23
0
        private bool ensureUnstructEventGet(Tracker t, MockGet g, bool expectBase64 = false)
        {
            var eventJson = new SelfDescribingJson(
                "iglu:com.acme/test/jsonschema/1-0-0",
                new Dictionary <string, string> {
                { "page", "testpage" },
                { "user", "tester" }
            }
                );

            t.Track(new SelfDescribing().SetEventData(eventJson).Build());
            t.Flush();

            var actual = g.Queries[0];

            var expectedPayload = @"{""schema"":""iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0"",""data"":{""schema"":""iglu:com.acme/test/jsonschema/1-0-0"",""data"":{""page"":""testpage"",""user"":""tester""}}}";
            var expected        = new Dictionary <string, string>
            {
                { "e", "ue" }
            };

            if (expectBase64)
            {
                string base64encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(expectedPayload));
                expected.Add("ue_px", base64encoded);
            }
            else
            {
                expected.Add("ue_pr", expectedPayload);
            }

            assertQueryContainsDefaults(actual);
            assertQueryContainsAll(actual, expected);

            return(true);
        }
コード例 #24
0
ファイル: PageControllerTest.cs プロジェクト: yysun/Rabbit
 public void Delete_Get()
 {
     dynamic page = new MockGet(new string[] { "Pages", "Delete", "id" });
     Mvc.Run(page, new PageController());
 }
コード例 #25
0
ファイル: PageControllerTest.cs プロジェクト: yysun/Rabbit
 public void Default_Post()
 {
     dynamic page = new MockGet(new string[] { "/" });
     Mvc.Run(page, new PageController());
     Assert_ShowDefaultPage(page);
 }
コード例 #26
0
ファイル: PageControllerTest.cs プロジェクト: yysun/Rabbit
    public void List_Should_Use_PageSize()
    {
        dynamic model = new Mock();
        model.Setup("List", new object[] { 5, 30 }, model);
        model.SetupGet("Value", new ExpandoObject());

        dynamic page = new MockGet(new string[] { "Pages", "List", "5", "30" });
        var controller = new PageController();
        controller.Model = model;
        Mvc.Run(page, controller);
        Assert.AreEqual("~/Views/Pages/_Page_List.cshtml", page.Page.View);
        model.Verify();
    }
コード例 #27
0
ファイル: PageControllerTest.cs プロジェクト: yysun/Rabbit
 public void Edit_Wrong_Id_Shoud_Goto_Create()
 {
     dynamic page = new MockGet(new string[] { "Pages", "Edit", "id" });
     Mvc.Run(page, new PageController());
     Assert.AreEqual("~/Pages/Create", page.Page.Redirect);
 }
コード例 #28
0
    [ExpectedException(typeof(Exception))] // Get is not allowed
    public void Delete_Get()
    {
        dynamic page = new MockGet(new string[] { "Pages", "Delete", "id" });

        Mvc.Run(page, new PageController());
    }
コード例 #29
0
ファイル: PageControllerTest.cs プロジェクト: yysun/Rabbit
    public void Edit_Get()
    {
        dynamic data = new ExpandoObject();
        data.Id = "id";
        dynamic model = new Mock();
        model.Setup("Load", new object[] { It.Is<dynamic>(item => item.Id == "id") }, model);
        model.SetupGet("Value", data);

        dynamic page = new MockGet(new string[] { "Pages", "Edit", "id" });
        var controller = new PageController();
        controller.Model = model;

        Mvc.Run(page, controller);
        var view = SiteEngine.RunHook("GET_Pages_Page_Edit_View", page.Page.View) as string;
        Assert.AreEqual(view, page.Page.View);
        Assert.AreEqual("id", page.Page.Model.Id);
        model.Verify();
    }
コード例 #30
0
ファイル: MvcTest.cs プロジェクト: yysun/Rabbit
 public void Routing_All()
 {
     dynamic webPage = new MockGet(new string[] { "Mock", "x", "y", "z" });
     dynamic controller = new MockController();
     Mvc.Run(webPage, controller);
     Assert.IsTrue(controller.All_Called);
     Assert.AreEqual("y", controller.UrlData[1]);
     Assert.AreEqual("z", controller.UrlData[2]);
     controller.Verify();
 }
コード例 #31
0
ファイル: MvcTest.cs プロジェクト: yysun/Rabbit
 public void Routing_Get()
 {
     dynamic webPage = new MockGet(new string[] { "Mock", "a", "1", "2" });
     dynamic controller = new MockController();
     Mvc.Run(webPage, controller);
     Assert.IsTrue(controller.Get_Called);
     controller.Verify();
 }
コード例 #32
0
ファイル: MvcTest.cs プロジェクト: yysun/Rabbit
 public void Get_Delete()
 {
     dynamic webPage = new MockGet(new string[] { "Mock", "Delete", "y", "z" });
     dynamic controller = new MockController();
     Mvc.Run(webPage, controller);
     controller.Verify();
 }
コード例 #33
0
ファイル: MvcTest.cs プロジェクト: yysun/Rabbit
 public void Get_Edit_Pass_String()
 {
     dynamic webPage = new MockGet(new string[] { "Mock", "Edit", "y", "z" });
     dynamic controller = new MockController();
     Mvc.Run(webPage, controller);
     Assert.AreEqual("y/z", controller.Id);
     controller.Verify();
 }
コード例 #34
0
        private bool ensureEcommerceTransactionWorksGet(Tracker t, MockGet g)
        {
            var hat   = new EcommerceTransactionItem().SetSku("pbz0026").SetPrice(20).SetQuantity(1).Build();
            var shirt = new EcommerceTransactionItem().SetSku("pbz0038").SetPrice(15).SetQuantity(1).SetName("shirt").SetCategory("clothing").Build();
            var items = new List <EcommerceTransactionItem> {
                hat, shirt
            };

            t.Track(new EcommerceTransaction()
                    .SetOrderId("6a8078be")
                    .SetTotalValue(35)
                    .SetAffiliation("affiliation")
                    .SetTaxValue(3)
                    .SetShipping(0)
                    .SetCity("Phoenix")
                    .SetState("Arizona")
                    .SetCountry("US")
                    .SetCurrency("USD")
                    .SetItems(items)
                    .Build());
            t.Flush();

            // other events may exist - lets find our best guesses for each

            var transactionActual = (from item in g.Queries
                                     where item.Contains("Phoenix")
                                     select item).ToList()[0];

            var hatActual = (from item in g.Queries
                             where item.Contains("pbz0026")
                             select item).ToList()[0];

            var shirtActual = (from item in g.Queries
                               where item.Contains("pbz0038")
                               select item).ToList()[0];

            var expectedTransaction = new Dictionary <string, string>
            {
                { "e", "tr" },
                { "tr_id", "6a8078be" },
                { "tr_tt", "35.00" },
                { "tr_af", "affiliation" },
                { "tr_tx", "3.00" },
                { "tr_sh", "0.00" },
                { "tr_ci", "Phoenix" },
                { "tr_st", "Arizona" },
                { "tr_co", "US" },
                { "tr_cu", "USD" }
            };

            assertQueryContainsDefaults(transactionActual);
            assertQueryContainsAll(transactionActual, expectedTransaction);

            var expectedHat = new Dictionary <string, string>
            {
                { "e", "ti" },
                { "ti_id", "6a8078be" },
                { "ti_sk", "pbz0026" },
                { "ti_pr", "20.00" },
                { "ti_qu", "1" },
                { "ti_cu", "USD" }
            };

            assertQueryContainsDefaults(hatActual);
            assertQueryContainsAll(hatActual, expectedHat);

            var expectedShirt = new Dictionary <string, string>
            {
                { "e", "ti" },
                { "ti_id", "6a8078be" },
                { "ti_sk", "pbz0038" },
                { "ti_nm", "shirt" },
                { "ti_ca", "clothing" },
                { "ti_pr", "15.00" },
                { "ti_qu", "1" },
                { "ti_cu", "USD" },
            };

            assertQueryContainsDefaults(shirtActual);
            assertQueryContainsAll(shirtActual, expectedShirt);

            return(true);
        }