public void ContainsKey()
        {
            var enumerable = connection.Run(testTable.Map(o => o.FreeformProperties.ContainsKey("best movie")));
            var numTrue    = enumerable.Count(r => r == true);
            var numFalse   = enumerable.Count(r => r == false);

            numTrue.Should().Be(1);
            numFalse.Should().Be(2);
        }
Ejemplo n.º 2
0
        public void DateTimeOffsetDateTimeConstructor()
        {
            var testObj = new TestObject3()
            {
                Value_Int  = 8,
                Value_Long = 2,
            };
            var resp = connection.Run(testTable3.Insert(testObj));

            Assert.That(resp.Inserted, Is.EqualTo(1));

            var result = connection.Run(testTable3.Map(testObject => new {
                DTO = new DateTimeOffset(new DateTime(2014, 6, 6, 6, 6, testObject.Value_Int)),
            })).Single();

            // this test is questionable because DateTimeOffset would normally be local in .NET, but we can't support
            // that server-side because we don't know the client-side's timezone in the expression tree.
            Assert.That(result.DTO, Is.EqualTo(new DateTimeOffset(new DateTime(2014, 6, 6, 6, 6, 8), TimeSpan.Zero)));
        }
Ejemplo n.º 3
0
        private async Task DoMap()
        {
            var enumerable = connection.RunAsync(testTable.Map(original => new AnotherTestObject()
            {
                FirstName = original.Name,
                LastName  = original.Name + " (?)",
            }));

            Assert.That(enumerable, Is.Not.Null);
            var count = 0;

            while (true)
            {
                if (!await enumerable.MoveNext())
                {
                    break;
                }
                ++count;
            }
            Assert.That(count, Is.EqualTo(7));
        }
Ejemplo n.º 4
0
        private async Task DoReduceToPrimitive()
        {
            var resp = await connection.RunAsync(testTable.Map(o => o.SomeNumber).Reduce((acc, val) => acc + val));

            Assert.That(resp, Is.EqualTo(1234));
        }