public async void GetFirstAsync_OneColumnFlattened_WithCql() { // Get random first created date and make sure it was one from our test data var createdDate = await CqlClient.FirstAsync <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 Func <Task> getUserId = async() => { var userId = await CqlClient.FirstAsync <Guid>("SELECT userid FROM users WHERE userid = ?", Guid.Empty).ConfigureAwait(false); }; getUserId.ShouldThrow <InvalidOperationException>(); }
public async void GetFirstAsync_Poco_WithCql() { // Get random first user and verify they are same as the user from test data var user = await CqlClient.FirstAsync <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 Func <Task> getUser = async() => { var notExistingUser = await CqlClient.FirstAsync <PlainUser>("SELECT * FROM users WHERE userid = ?", Guid.Empty).ConfigureAwait(false); }; getUser.ShouldThrow <InvalidOperationException>(); }