Example #1
0
        public async void InsertAsync_FluentPoco()
        {
            // Get a "new" user by using the test data from an existing user and changing the primary key
            TestUser user    = TestDataHelper.Users.First();
            var      newUser = new FluentUser
            {
                Id               = Guid.NewGuid(),
                Name             = user.Name,
                Age              = user.Age,
                CreatedDate      = user.CreatedDate,
                IsActive         = user.IsActive,
                LastLoginDate    = user.LastLoginDate,
                LoginHistory     = user.LoginHistory,
                LuckyNumbers     = user.LuckyNumbers,
                ChildrenAges     = user.ChildrenAges,
                FavoriteColor    = user.FavoriteColor,
                TypeOfUser       = user.TypeOfUser,
                PreferredContact = user.PreferredContactMethod,
                HairColor        = user.HairColor
            };

            // Insert the new user
            await CqlClient.InsertAsync(newUser);

            // Fetch and verify
            var foundUser = await CqlClient.SingleAsync <FluentUser>("WHERE userid = ?", newUser.Id);

            foundUser.ShouldBeEquivalentTo(newUser, opt => opt.AccountForTimestampAccuracy());
        }