Example #1
0
        public void Left_join_empty_tables()
        {
            var table1 = new HashTable <string>(10);
            var table2 = new HashTable <string>(10);
            var join   = new LeftJoin(table1, table2);
            var result = join.LeftJoinTables();

            Assert.Empty(result);
            Assert.False(result.Contains(""));
        }
Example #2
0
        public void Left_join_tables_left_joins_tables(string x)
        {
            var table1 = new HashTable <string>(10);

            table1.Add("fond", "enamored");
            table1.Add("wrath", "anger");
            table1.Add("diligent", "employed");
            table1.Add("outfit", "garb");
            table1.Add("guide", "usher");
            var table2 = new HashTable <string>(10);

            table2.Add("fond", "averse");
            table2.Add("wrath", "delight");
            table2.Add("diligent", "idle");
            table2.Add("guide", "follow");
            table2.Add("flow", "jam");

            var join = new LeftJoin(table1, table2);

            var expect = new HashTable <List <string> >(10);

            expect.Add("fond", new List <string>()
            {
                "enamored", "averse"
            });;
            expect.Add("wrath", new List <string>()
            {
                "anger", "delight"
            });
            expect.Add("diligent", new List <string>()
            {
                "employed", "idle"
            });
            expect.Add("outfit", new List <string>()
            {
                "garb"
            });
            expect.Add("guide", new List <string>()
            {
                "usher", "follow"
            });

            var result = join.LeftJoinTables();



            Assert.True(expect.TryFind(x, out var y));
            Assert.True(result.TryFind(x, out var z));

            //Assert.Equal(expect, result);
            Assert.Equal(y, z);
            Assert.Equal(expect[x], result[x]);
        }