Esempio n. 1
0
        public async Task GlobalSetup()
        {
            _javaServer = await JavaServer.StartAsync();

            _client = await IgniteClient.StartAsync(new IgniteClientConfiguration("127.0.0.1:" + _javaServer.Port));

            _table = (await _client.Tables.GetTableAsync("PUB.tbl1")) !.RecordBinaryView;

            var tuple = new IgniteTuple
            {
                ["key"] = 1,
                ["val"] = "foo"
            };

            await _table.UpsertAsync(null, tuple);

            _keyTuple = new IgniteTuple
            {
                ["key"] = 1
            };
        }
Esempio n. 2
0
        public void TestGetNullOrEmptyNameThrowsException()
        {
            var tuple = new IgniteTuple {
                ["Foo"] = 1
            };

            var ex = Assert.Throws <IgniteClientException>(() => tuple.GetOrdinal(string.Empty));

            Assert.AreEqual("Column name can not be null or empty.", ex !.Message);

            ex = Assert.Throws <IgniteClientException>(() => tuple.GetOrdinal(null !));
            Assert.AreEqual("Column name can not be null or empty.", ex !.Message);

            ex = Assert.Throws <IgniteClientException>(() =>
            {
                var unused = tuple[string.Empty];
            });
            Assert.AreEqual("Column name can not be null or empty.", ex !.Message);

            ex = Assert.Throws <IgniteClientException>(() =>
            {
                var unused = tuple[null !];
            });
Esempio n. 3
0
        public void TestCreateUpdateRead()
        {
            IIgniteTuple tuple = new IgniteTuple();

            Assert.AreEqual(0, tuple.FieldCount);

            tuple["foo"] = 1;
            tuple["bar"] = Guid.Empty;

            Assert.AreEqual(2, tuple.FieldCount);

            Assert.AreEqual(1, tuple["foo"]);
            Assert.AreEqual(Guid.Empty, tuple["bar"]);

            Assert.AreEqual(1, tuple[0]);
            Assert.AreEqual(Guid.Empty, tuple[1]);

            Assert.AreEqual("FOO", tuple.GetName(0));
            Assert.AreEqual("BAR", tuple.GetName(1));

            Assert.AreEqual(0, tuple.GetOrdinal("foo"));
            Assert.AreEqual(0, tuple.GetOrdinal("Foo"));
            Assert.AreEqual(0, tuple.GetOrdinal("FOO"));
            Assert.AreEqual(0, tuple.GetOrdinal("\"FOO\""));
            Assert.AreEqual(-1, tuple.GetOrdinal("\"Foo\""));
            Assert.AreEqual(1, tuple.GetOrdinal("bar"));

            tuple[0]     = 2;
            tuple["bar"] = "x";
            tuple["qux"] = null;

            Assert.AreEqual(3, tuple.FieldCount);

            Assert.AreEqual(2, tuple["foo"]);
            Assert.AreEqual("x", tuple[1]);
            Assert.IsNull(tuple[2]);
        }