Example #1
0
        public void ClassInfoIntegationTests_AddClass()
        {
            using (PrivateClassesDBContext dbContext = new PrivateClassesDBContext())
            {
                ClassInfoRepo repo = new ClassInfoRepo(dbContext);
                repo.Add(new ClassInfo {
                    ClassCategoryId = 1, ClassName = "TestClass", Location = "Trails", ProductCode = "C12345", DateStart = DateTime.Now, DateEnd = DateTime.Now
                });
                try
                {
                    dbContext.SaveChanges();
                }
                catch (DbEntityValidationException exc)
                {
                    Assert.Fail(exc.EntityValidationErrors.ToString());
                }
                catch (Exception exc)
                {
                    Assert.Fail(exc.ToString());
                }

                var res = repo.FindOne(c => c.ClassName == "TestClass");
                Assert.IsNotNull(res);
            }
        }
Example #2
0
        public void ParticipantTests_FindOne_Mock()
        {
            ClassInfoRepo repo = new ClassInfoRepo(GetMockContext().Object)
            {
                IncludeNavigationProperties = false
            };

            var res = repo.FindOne(x => x.ClassName.ToLower().Contains("birthday") && x.ClassCategory.CategoryName.ToLower() == "party");

            Assert.IsTrue(res != null);
        }