public void PhotographerViewModel_should_fail_validate_future_BirthDay() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.BirthDay = DateTime.Today.AddYears(1); AssertFalse("IsValidBirthDay == false", vmdl.IsValidBirthDay); }
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); } }
public void PhotographerViewModel_should_validate_null_BirthDay() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.BirthDay = null; AssertTrue("IsValidBirthDay == true", vmdl.IsValidBirthDay); }
public void PhotographerViewModel_should_validate_BirthDay() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.BirthDay = DateTime.Today.AddYears(-36); AssertTrue("IsValidBirthDay == true", vmdl.IsValidBirthDay); }
public void PhotographerViewModel_should_fail_validate_on_null_LastName() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.LastName = null; AssertFalse("IsValidLastName == false", vmdl.IsValidLastName); }
public void PhotographerViewModel_should_validate_LastName() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.LastName = "Testinger"; AssertTrue("IsValidLastName == true", vmdl.IsValidLastName); }
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); }
public void PhotographerViewModel_should_fail_with_summary_3() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.LastName = ""; vmdl.BirthDay = DateTime.Today.AddYears(1); AssertNotEmptyOrNull(vmdl.ValidationSummary); }
public void PhotographerViewModel_should_validate_2() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.LastName = "Gruber"; vmdl.BirthDay = null; AssertTrue("IsValid == true", vmdl.IsValid); }
public void PhotographerViewModel_should_validate() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.LastName = "Gruber"; vmdl.BirthDay = DateTime.Today.AddYears(-1); AssertTrue("IsValid == true", vmdl.IsValid); }
public void PhotographerViewModel_should_fail_validate_2() { IPhotographerViewModel vmdl = GetViewModel(); vmdl.LastName = "Gruber"; vmdl.BirthDay = DateTime.Today.AddYears(1); AssertFalse("IsValid == false", vmdl.IsValid); }
public PhotographerModel(IPhotographerViewModel viewModel) { ID = viewModel.ID; FirstName = viewModel.FirstName; LastName = viewModel.LastName; BirthDay = viewModel.BirthDay; Notes = viewModel.Notes; }
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; }
private IPhotographerViewModel GetViewModel() { IPhotographerModel mdl = ueb.GetEmptyPhotographerModel(); AssertNotNull("GetEmptyPhotographerModel", mdl); IPhotographerViewModel vmdl = ueb.GetPhotographerViewModel(mdl); AssertNotNull("GetPhotographerViewModel", vmdl); return(vmdl); }
/// <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); }
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); }
public void Hello_Empty_PhotographerViewModel() { IPhotographerViewModel obj = ueb.GetEmptyPhotographerViewModel(); AssertNotNull("GetEmptyPhotographerViewModel", obj); }