Exemplo n.º 1
0
        public void PhotographerViewModel_should_fail_validate_future_BirthDay()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.BirthDay = DateTime.Today.AddYears(1);
            AssertFalse("IsValidBirthDay == false", vmdl.IsValidBirthDay);
        }
Exemplo n.º 2
0
 public PictureViewModel(IPictureModel pm)
 {
     _PictureModel = (PictureModel)pm;
     _PictureModel.PropertyChanged += new PropertyChangedEventHandler(SubPropertyChanged);
     if (_PictureModel.IPTC != null)
     {
         _IPTCViewModel = new IPTCViewModel(_PictureModel.IPTC);
         ((IPTCViewModel)_IPTCViewModel).PropertyChanged += new PropertyChangedEventHandler(SubPropertyChanged);
     }
     if (_PictureModel.EXIF != null)
     {
         _EXIFViewModel = new EXIFViewModel(_PictureModel.EXIF, this);
         ((EXIFViewModel)_EXIFViewModel).PropertyChanged += new PropertyChangedEventHandler(SubPropertyChanged);
     }
     if (_PictureModel.Photographer != null)
     {
         _PhotographerViewModel = new PhotographerViewModel(_PictureModel.Photographer);
         ((PhotographerViewModel)_PhotographerViewModel).PropertyChanged += new PropertyChangedEventHandler(SubPropertyChanged);
     }
     if (_PictureModel.Camera != null)
     {
         _CameraViewModel = new CameraViewModel(_PictureModel.Camera);
         ((CameraViewModel)_CameraViewModel).PropertyChanged += new PropertyChangedEventHandler(SubPropertyChanged);
     }
 }
Exemplo n.º 3
0
        public void PhotographerViewModel_should_validate_null_BirthDay()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.BirthDay = null;
            AssertTrue("IsValidBirthDay == true", vmdl.IsValidBirthDay);
        }
Exemplo n.º 4
0
        public void PhotographerViewModel_should_validate_BirthDay()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.BirthDay = DateTime.Today.AddYears(-36);
            AssertTrue("IsValidBirthDay == true", vmdl.IsValidBirthDay);
        }
Exemplo n.º 5
0
        public void PhotographerViewModel_should_fail_validate_on_null_LastName()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.LastName = null;
            AssertFalse("IsValidLastName == false", vmdl.IsValidLastName);
        }
Exemplo n.º 6
0
        public void PhotographerViewModel_should_validate_LastName()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.LastName = "Testinger";
            AssertTrue("IsValidLastName == true", vmdl.IsValidLastName);
        }
Exemplo n.º 7
0
        public void PhotographerViewModel_should_return_empty_summary_on_valid_state()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.LastName = "Gruber";
            vmdl.BirthDay = DateTime.Today.AddYears(-1);
            AssertEmptyOrNull(vmdl.ValidationSummary);
        }
Exemplo n.º 8
0
        public void PhotographerViewModel_should_fail_with_summary_3()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.LastName = "";
            vmdl.BirthDay = DateTime.Today.AddYears(1);
            AssertNotEmptyOrNull(vmdl.ValidationSummary);
        }
Exemplo n.º 9
0
        public void PhotographerViewModel_should_validate_2()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.LastName = "Gruber";
            vmdl.BirthDay = null;
            AssertTrue("IsValid == true", vmdl.IsValid);
        }
Exemplo n.º 10
0
        public void PhotographerViewModel_should_validate()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.LastName = "Gruber";
            vmdl.BirthDay = DateTime.Today.AddYears(-1);
            AssertTrue("IsValid == true", vmdl.IsValid);
        }
Exemplo n.º 11
0
        public void PhotographerViewModel_should_fail_validate_2()
        {
            IPhotographerViewModel vmdl = GetViewModel();

            vmdl.LastName = "Gruber";
            vmdl.BirthDay = DateTime.Today.AddYears(1);
            AssertFalse("IsValid == false", vmdl.IsValid);
        }
Exemplo n.º 12
0
 public PhotographerModel(IPhotographerViewModel viewModel)
 {
     ID        = viewModel.ID;
     FirstName = viewModel.FirstName;
     LastName  = viewModel.LastName;
     BirthDay  = viewModel.BirthDay;
     Notes     = viewModel.Notes;
 }
Exemplo n.º 13
0
 public PhotographerModel(IPhotographerViewModel photographer)
 {
     if (photographer == null)
     {
         return;
     }
     this.ID        = photographer.ID;
     this.BirthDay  = photographer.BirthDay;
     this.FirstName = photographer.FirstName;
     this.LastName  = photographer.LastName;
     this.Notes     = photographer.Notes;
 }
Exemplo n.º 14
0
        private IPhotographerViewModel GetViewModel()
        {
            IPhotographerModel mdl = ueb.GetEmptyPhotographerModel();

            AssertNotNull("GetEmptyPhotographerModel", mdl);

            IPhotographerViewModel vmdl = ueb.GetPhotographerViewModel(mdl);

            AssertNotNull("GetPhotographerViewModel", vmdl);

            return(vmdl);
        }
Exemplo n.º 15
0
        /// <summary>
        /// save photographer changes to database
        /// check if model is valid and undo updates if not valid
        /// </summary>
        /// <param name="currentPhotographer"></param>
        internal void CurrentPhotographerChanged(IPhotographerViewModel currentPhotographer)
        {
            PhotographerViewModel pvm = (PhotographerViewModel)currentPhotographer;

            if (!pvm.IsValid)
            {
                Error(pvm.ValidationSummary);
                pvm.UndoUpdate();
                return;
            }

            Save(pvm.PhotographerModel);
        }
Exemplo n.º 16
0
        public void PhotographerViewModel_should_reflect_Model()
        {
            IPhotographerModel mdl = ueb.GetEmptyPhotographerModel();

            AssertNotNull("GetEmptyPhotographerModel", mdl);

            var dt = DateTime.Today.AddYears(-36);

            mdl.FirstName = "Bernhard";
            mdl.LastName  = "Testinger";
            mdl.BirthDay  = dt;

            IPhotographerViewModel vmdl = ueb.GetPhotographerViewModel(mdl);

            AssertNotNull("GetPhotographerViewModel", vmdl);
            AssertEquals("Bernhard", vmdl.FirstName);
            AssertEquals("Testinger", vmdl.LastName);
            AssertEquals(dt, vmdl.BirthDay);
        }
Exemplo n.º 17
0
        public void Hello_Empty_PhotographerViewModel()
        {
            IPhotographerViewModel obj = ueb.GetEmptyPhotographerViewModel();

            AssertNotNull("GetEmptyPhotographerViewModel", obj);
        }