Example #1
0
        public void CanCreatePresentationFromRepositoryAndHaveAccessFromUser()
        {
            using (var repo = new DBRepository(GetDBContext()))
            {
                if (repo.Users != null)
                {
                    var user = repo.Users.ToArray()[0];
                    repo.CreatePresentation(new Presentation {
                        CreateDate = DateTime.Now, Description = "Simple Presentation", Name = "Presentation", User = user, PresentationId = Guid.NewGuid()
                    });
                    repo.SaveChanges();

                    Presentation presentation = repo.Presentations.FirstOrDefault(x => x.Name == "Presentation");

                    Assert.IsNotNull(presentation);
                    Assert.AreEqual(presentation.User.UserId, user.UserId);
                    Assert.AreEqual(presentation.Description, "Simple Presentation");
                }
                else
                {
                    Assert.Fail("No Users in Repository");
                }
            }
        }