public void GivenPrivateHealthDataViewEvent_WhenAdd_ThenAddToContext()
        {
            var expected = new PrivateHealthDataViewEvent { Id = 1 };

            Target.Add(expected);

            MockDbSet.AssertWasCalled(m => m.Add(expected));
        }
 public void Update(PrivateHealthDataViewEvent item)
 {
     throw new NotSupportedException("Update is not supported in this repository");
 }
 public void Add(PrivateHealthDataViewEvent item)
 {
     Context.PrivateHealthDataViewEvents.Add(item);
 }
        public void WhenConstruct_ThenCreateTimeSet()
        {
            PrivateHealthDataViewEvent actual = new PrivateHealthDataViewEvent();

            Assert.IsTrue(actual.CreateTime.WithinTimeSpanOf(TimeSpan.FromMilliseconds(20), DateTime.Now));
        }
        public void GivenPrivateHealthDataViewEvent_WhenUpdate_ThenThrowException()
        {
            var item = new PrivateHealthDataViewEvent { Id = 1 };

            Target.ExpectException<NotSupportedException>(() => Target.Update(item));
        }
        public void GivenValidStudentId_WhenGenerateStudentDetailViewModel_ThenPrivateHealthDataViewRepositorySaves()
        {
            PermissionFactory.Current.Expect(m => m.Create("ViewStudentDetail", Data.Students.Single(s => s.Id == 1))).Return(MockRepository.GenerateMock<IViewStudentDetailPermission>());
            foreach (var field in Data.Students.Single(s => s.Id == 1).CustomFieldValues.Select(c => c.CustomField))
            {
                PermissionFactory.Current.Expect(m => m.Create("ViewStudentCustomFieldData", field)).Return(MockRepository.GenerateMock<IPermission>());
            }
            PrivateHealthDataViewEvent privateHealthDataViewEvent = new PrivateHealthDataViewEvent{ Id = 1 };
            MockUserAuditor.Expect(m => m.CreatePrivateHealthInfoViewEvent(User.Identity.User, Data.Students.Single(s => s.Id == 1).CustomFieldValues.Where(c => c.CustomField is PrivateHealthField).ToList())).Return(privateHealthDataViewEvent);

            var result = Target.GenerateStudentDetailViewModel(User, 1);

            Repositories.MockPrivateHealthDataViewEventRepository.AssertWasCalled(m => m.Add(privateHealthDataViewEvent));
            Repositories.MockRepositoryContainer.AssertWasCalled(m => m.Save());
        }
        public void WhenConstruct_ThenCreateTimeSet()
        {
            PrivateHealthDataViewEvent actual = new PrivateHealthDataViewEvent();

            Assert.IsTrue(actual.CreateTime.WithinTimeSpanOf(TimeSpan.FromMilliseconds(20), DateTime.Now));
        }