Ejemplo n.º 1
0
            static void Main(string[] args)
            {
                int[,] integer2DArray = new int[, ] {
                    { 74, 46, 42 },
                    { 2, 63, 24 },
                    { 83, 76, 98 },
                    { 10, 3, 4 },
                    { 28, 63, 79 }
                };

                HashTest.printDimensionalArray(integer2DArray);
                Console.WriteLine();
                // search array
                HashSet <int> setA = new HashSet <int>(HashTest.SearchSmallestPerColumn(integer2DArray));
                HashSet <int> setB = new HashSet <int>(HashTest.SearchBiggestPerRow(integer2DArray));

                HashTest.printHashSet(setA);
                HashTest.printHashSet(setB);
                Console.WriteLine();

                HashSet <int> resultaat1 = new HashSet <int>(setA);

                resultaat1.UnionWith(setB);
                HashTest.printHashSet(resultaat1);

                HashSet <int> resultaat2 = new HashSet <int>(setA);

                resultaat2.IntersectWith(setB);

                CheckThizz(resultaat2, setB);
            }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            HashTest.DoTest3();


            Console.ReadLine();
        }
        public void Can_store_as_Hash()
        {
            var dto = new HashTest {
                Id = 1
            };

            Redis.StoreAsHash(dto);

            var storedHash = Redis.GetHashKeys(dto.ToUrn());

            Assert.That(storedHash, Is.EquivalentTo(new[] { "Id" }));

            var hold = RedisClient.ConvertToHashFn;

            RedisClient.ConvertToHashFn = o =>
            {
                var map = new Dictionary <string, string>();
                o.ToObjectDictionary().Each(x => map[x.Key] = (x.Value ?? "").ToJsv());
                return(map);
            };

            Redis.StoreAsHash(dto);
            storedHash = Redis.GetHashKeys(dto.ToUrn());
            Assert.That(storedHash, Is.EquivalentTo(new[] { "Id", "Name" }));

            RedisClient.ConvertToHashFn = hold;
        }
Ejemplo n.º 4
0
        public void Can_store_as_Hash()
        {
            var dto = new HashTest {
                Id = 1
            };

            this.Redis.StoreAsHash(dto);

            var storedHash = this.Redis.GetHashKeys(dto.ToUrn());

            Assert.That(storedHash, Is.EquivalentTo(new[] { "Id" }));

            var hold = RedisClient.ConvertToHashFn;

            RedisClient.ConvertToHashFn = o => {
                var dictionary = JObject.FromObject(o).ToObject <Dictionary <string, string> >();
                var dict       = new Dictionary <string, string>();
                foreach (var pair in dictionary)
                {
                    dict[pair.Key] = pair.Value ?? "";
                }

                return(dict);
            };

            this.Redis.StoreAsHash(dto);
            storedHash = this.Redis.GetHashKeys(dto.ToUrn());
            Assert.That(storedHash, Is.EquivalentTo(new[] { "Id", "Name" }));

            RedisClient.ConvertToHashFn = hold;
        }
Ejemplo n.º 5
0
 public static void CheckThizz(HashSet <int> hashset1, HashSet <int> hashset2)
 {
     if (hashset1.Count > 0)
     {
         HashTest.printHashSet(hashset1);
     }
     else
     {
         Console.WriteLine($"{nameof(hashset1)} heeft geen elementen overeen met {nameof(hashset2)}");
     }
 }
Ejemplo n.º 6
0
        public void TestOne()
        {
            HashTest sut = new HashTest();

            //int[] test = new[] {5,4,4,5,0,12 };
            int[] test     = new[] { 3, 4, 5, 5, 2 };
            int[] expected = new[] { 3, 4, 5, 2 };
            var   result   = sut.solution(test);

            result.SequenceEqual(expected).Should().BeTrue();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            HashTest.Run();

            Console.Read();
        }
        public void Can_store_as_Hash()
        {
            var dto = new HashTest { Id = 1 };
            Redis.StoreAsHash(dto);

            var storedHash = Redis.GetHashKeys(dto.ToUrn());
            Assert.That(storedHash, Is.EquivalentTo(new[] { "Id" }));

            var hold = RedisClient.ConvertToHashFn;
            RedisClient.ConvertToHashFn = o =>
            {
                var map = new Dictionary<string, string>();
                o.ToObjectDictionary().Each(x => map[x.Key] = (x.Value ?? "").ToJsv());
                return map;
            };

            Redis.StoreAsHash(dto);
            storedHash = Redis.GetHashKeys(dto.ToUrn());
            Assert.That(storedHash, Is.EquivalentTo(new[] { "Id", "Name" }));

            RedisClient.ConvertToHashFn = hold;
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            HashTest test = new HashTest();

            test.TestMethodGetHashCode();
        }