示例#1
0
        public void GetFirst_OneColumnFlattened_WithCql()
        {
            // Get random first created date and make sure it was one from our test data
            var createdDate = CqlClient.First <DateTimeOffset>("SELECT createddate FROM users");

            TestDataHelper.Users.Select(u => u.CreatedDate.ToMillisecondPrecision()).Should().Contain(createdDate);

            // Verify getting random first for user that doesn't exist throws
            Action getUserId = () =>
            {
                var userId = CqlClient.First <Guid>("SELECT userid FROM users WHERE userid = ?", Guid.Empty);
            };

            getUserId.ShouldThrow <InvalidOperationException>();
        }
示例#2
0
        public void GetFirst_Poco_WithCql()
        {
            // Get random first user and verify they are same as the user from test data
            var user = CqlClient.First <PlainUser>("SELECT * FROM users");

            user.ShouldBeEquivalentTo(TestDataHelper.Users.Single(u => u.UserId == user.UserId), opt => opt.AccountForTimestampAccuracy());

            // Get first user where user id doesn't exist and verify it throws
            Action getUser = () =>
            {
                var notExistingUser = CqlClient.First <PlainUser>("SELECT * FROM users WHERE userid = ?", Guid.Empty);
            };

            getUser.ShouldThrow <InvalidOperationException>();
        }