Example #1
0
        //[Fact]
        public async Task ModifyBaby()
        {
            var connectionString = Configuration.GetConnectionString("mongoTest");
            var context          = new TestMongoContext(connectionString);

            var baby = context.Babies.FirstOrDefault(b => b.Name == "William" || b.Name == "Whitney");

            baby.Name = baby.Name == "Whitney" ? "William" : "Whitney";

            var result = await context.SaveChanges();

            Assert.Equal(1, result);
        }
Example #2
0
        public async Task AddBaby()
        {
            var connectionString = Configuration.GetConnectionString("mongoTest");
            var context          = new TestMongoContext(connectionString);

            var newBaby = new Baby()
            {
                Name = "Whitney", BirthDay = DateTime.Now
            };

            context.Babies.Add(newBaby);

            await context.SaveChanges();
        }