# HG changeset patch # User stevenhollidge # Date 1336220996 -3600 # Node ID 188f8b366e8702185902f72519b4e2b162b8d342 # Parent 64e9903703a36137df8313c47514b3c0a04f980c Unit test project correctly setup as normal class library DLL. diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/Libs/Microsoft.Silverlight.Testing.dll Binary file SilverlightValidation/Libs/Microsoft.Silverlight.Testing.dll has changed diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/Libs/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll Binary file SilverlightValidation/Libs/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll has changed diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/Libs/NUnit.Silverlight.Compatibility.dll Binary file SilverlightValidation/Libs/NUnit.Silverlight.Compatibility.dll has changed diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/Libs/NUnit.Silverlight.Framework.dll Binary file SilverlightValidation/Libs/NUnit.Silverlight.Framework.dll has changed diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/Libs/NUnit.Silverlight.Metadata.dll Binary file SilverlightValidation/Libs/NUnit.Silverlight.Metadata.dll has changed diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Commands/RelayCommand.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Commands/RelayCommand.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,40 @@ +using System; +using System.Windows.Input; + +namespace SilverlightValidation.Commands +{ + public class RelayCommand : ICommand + { + public event EventHandler CanExecuteChanged = delegate { }; + + readonly Action _execute; + readonly Predicate _canExecute; + + public RelayCommand(Action execute, + Predicate canExecute = null) + { + if (execute == null) throw new ArgumentNullException("execute"); + + _execute = execute; + _canExecute = canExecute; + } + + + public void UpdateCanExecuteCommand() + { + CanExecuteChanged(this, new EventArgs()); + } + + + public bool CanExecute(object parameter) + { + return _canExecute == null || _canExecute(parameter); + } + + + public void Execute(object parameter) + { + _execute(parameter); + } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Data/Factory.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Data/Factory.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using SilverlightValidation.Models; + +namespace SilverlightValidation.Data +{ + public class Factory + { + public static IList CreateUserModels() + { + return new List(5) + { + new UserModel() { Username = "StevenH", Password = "Password1", Email = "steven@hotmail.com", DateOfBirth = new DateTime(1977, 09, 01), Description = ""}, + new UserModel() { Username = "RichardJ", Password = "12N456a", Email = "dicky@gmail.com", DateOfBirth = new DateTime(1983, 03, 13), Description = "Loves .Net!"}, + new UserModel() { Username = "BobbyP", Password = "pa33Word", Email = "bob@yahoo.co.uk", DateOfBirth = new DateTime(1992, 08, 30), Description = ""}, + new UserModel() { Username = "DavidM", Password = "poIu789", Email = "daveyboy@marsh.com", DateOfBirth = new DateTime(1965, 06, 21), Description = "Java fan boy"}, + new UserModel() { Username = "JessieJ", Password = "jlkJh567", Email = "jj@apple.co.uk", DateOfBirth = new DateTime(1990, 10, 15), Description = ""} + }; + } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Diagrams/Overview.cd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Diagrams/Overview.cd Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,63 @@ + + + + + + AAAAAAAAACAgAAAAAQAAAAAAAAAQAEACAAAAAAAAABA= + Models\UserModel.cs + + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAA= + Validators\UserModelValidator.cs + + + + + + AAAAAAAAAAAAAAECAAAAAAAAAAAAABAYABEACAAAAAA= + ViewModels\UserListViewModel.cs + + + + + + UAAAoIAADCIgAAAAMYAACAAAAAAQABAKQEAAAAAgIAA= + ViewModels\UserViewModel.cs + + + + + + + AAAAAAACAABQAAABAAAAAgAAgAAAAACIAAAAAAARAAA= + ViewModels\ViewModelBase.cs + + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA= + Messages\UserViewResponseMessage.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA= + Interfaces\ICloneable.cs + + + + + + AAAAAAAAACAgAAAAAQAAAAAAAAAQAAACAAAAAAAAAAA= + Interfaces\IUserModel.cs + + + + \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Interfaces/ICloneable.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Interfaces/ICloneable.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,7 @@ +namespace SilverlightValidation.Interfaces +{ + public interface ICloneable + { + T Clone(); + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Interfaces/IUserModel.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Interfaces/IUserModel.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,12 @@ +using System; +namespace SilverlightValidation.Interfaces +{ + public interface IUserModel + { + string Username { get; set; } + string Email { get; set; } + string Password { get; set; } + DateTime? DateOfBirth { get; set; } + string Description { get; set; } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Messages/UserViewResponseMessage.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Messages/UserViewResponseMessage.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,10 @@ +using GalaSoft.MvvmLight.Messaging; +using SilverlightValidation.ViewModels; + +namespace SilverlightValidation.Messages +{ + public class UserViewResponseMessage : MessageBase + { + public UserViewModel UserViewModel { get; set; } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Models/UserModel.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Models/UserModel.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,25 @@ +using System; +using System.ComponentModel; +using SilverlightValidation.Interfaces; + +namespace SilverlightValidation.Models +{ + public class UserModel : IUserModel, ICloneable + { + public string Username { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public DateTime? DateOfBirth { get; set; } + public string Description { get; set; } + + public static UserModel Create() + { + return new UserModel() { Username = "", Email = "", Password = "", DateOfBirth = null, Description = "" }; + } + + public UserModel Clone() + { + return (UserModel) this.MemberwiseClone(); + } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Properties/AssemblyInfo.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SilverlightValidation.PL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SilverlightValidation.PL")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f669b434-6d0f-48d5-917b-00c92d4ccfee")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/SilverlightValidation.PL.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/SilverlightValidation.PL.csproj Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,98 @@ + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {13B5F568-F402-4A2A-9A23-0FDF0B5564E3} + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + SilverlightValidation.PL + SilverlightValidation.PL + Silverlight + v5.0 + $(TargetFrameworkVersion) + false + true + true + + + + v3.5 + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT + true + true + prompt + 4 + + + + ..\Libs\FluentValidation.dll + + + False + ..\Libs\GalaSoft.MvvmLight.SL5.dll + + + + + + + ..\Libs\System.Windows.Controls.dll + + + ..\Libs\System.Windows.Controls.Navigation.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/Validators/UserModelValidator.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/Validators/UserModelValidator.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,36 @@ +using System; +using FluentValidation; +using SilverlightValidation.Interfaces; + +namespace SilverlightValidation.Validators +{ + public class UserModelValidator : AbstractValidator + { + public UserModelValidator() + { + RuleFor(x => x.Username) + .Length(3, 8) + .WithMessage("Must be between 3-8 characters."); + + RuleFor(x => x.Password) + .Matches(@"^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$") + .WithMessage("Must contain lower, upper and numeric chars."); + + RuleFor(x => x.Email) + .EmailAddress() + .WithMessage("A valid email address is required."); + + RuleFor(x => x.DateOfBirth) + .Must(BeAValidDateOfBirth) + .WithMessage("Must be within 100 years of today."); + } + + private bool BeAValidDateOfBirth(DateTime? dateOfBirth) + { + if (dateOfBirth == null) return false; + if (dateOfBirth.Value > DateTime.Today || dateOfBirth < DateTime.Today.AddYears(-100)) + return false; + return true; + } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/ViewModels/UserListViewModel.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/ViewModels/UserListViewModel.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,65 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Windows.Controls; +using System.Windows.Input; +using SilverlightValidation.Commands; +using SilverlightValidation.Models; +using SilverlightValidation.Validators; +using GalaSoft.MvvmLight.Messaging; +using SilverlightValidation.Messages; + +namespace SilverlightValidation.ViewModels +{ + public class UserListViewModel + { + private ChildWindow _window; + + public UserListViewModel(ChildWindow window, IList models, UserModelValidator validator) + { + _window = window; + + Data = new ObservableCollection(); + + foreach (var model in models) + Data.Add(new UserViewModel(model, validator)); + + AddCommand = new RelayCommand(AddCommandExecute); + DeleteCommand = new RelayCommand(DeleteCommandExecute); + + Messenger.Default.Register(this, UserViewResponseMessageReceived); + } + + private void UserViewResponseMessageReceived(UserViewResponseMessage userViewResponseMessage) + { + if (userViewResponseMessage.UserViewModel != null) + Data.Add(userViewResponseMessage.UserViewModel); + _window.Close(); + } + + #region Properties + + public ObservableCollection Data { get; set; } + + public UserViewModel SelectedItem { get; set; } + + #endregion + + #region Commands + + public ICommand AddCommand { get; set; } + public ICommand DeleteCommand { get; set; } + + private void AddCommandExecute(object obj) + { + _window.Show(); + } + + private void DeleteCommandExecute(object obj) + { + if (SelectedItem!=null) + Data.Remove(SelectedItem); + } + + #endregion + } +} \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/ViewModels/UserViewModel.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/ViewModels/UserViewModel.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,223 @@ +using System; +using System.ComponentModel; +using System.Linq; +using System.Windows; +using System.Windows.Input; +using FluentValidation; +using SilverlightValidation.Interfaces; +using SilverlightValidation.Validators; +using SilverlightValidation.Models; +using SilverlightValidation.Commands; +using GalaSoft.MvvmLight.Messaging; +using SilverlightValidation.Messages; + +namespace SilverlightValidation.ViewModels +{ + public class UserViewModel : ViewModelBase, IUserModel, IEditableObject + { + #region Fields + + private readonly UserModelValidator _validator; + private UserModel _data; + private UserModel _backup; + + #endregion + + #region Constructor + + public UserViewModel(UserModel model, UserModelValidator validator) + { + _validator = validator; + _data = model; + _backup = model.Clone(); + + OkCommand = new RelayCommand(OkCommandExecute); + CancelCommand = new RelayCommand(CancelCommandExecute); + } + + #endregion + + #region Methods + + private void SetProperties(IUserModel source) + { + _data.Username = source.Username; + _data.Password = source.Password; + _data.Email = source.Email; + _data.DateOfBirth = source.DateOfBirth; + _data.Description = source.Description; + } + + #endregion + + #region Properties + + private const string UsernameProperty = "Username"; + public string Username + { + get { return _data.Username; } + set + { + if (_data.Username != value) + { + _data.Username = value; + RaisePropertyChanged(UsernameProperty); + IsChanged = true; + } + + ClearError(UsernameProperty); + var validationResult = _validator.Validate(this, UsernameProperty); + if (!validationResult.IsValid) + validationResult.Errors.ToList().ForEach(x => SetError(UsernameProperty, x.ErrorMessage)); + } + } + + private const string PasswordProperty = "Password"; + public string Password + { + get { return _data.Password; } + set + { + if (_data.Password != value) + { + _data.Password = value; + RaisePropertyChanged(PasswordProperty); + IsChanged = true; + } + + ClearError(PasswordProperty); + var validationResult = _validator.Validate(this, PasswordProperty); + if (!validationResult.IsValid) + validationResult.Errors.ToList().ForEach(x => SetError(PasswordProperty, x.ErrorMessage)); + } + } + + private const string EmailProperty = "Email"; + public string Email + { + get { return _data.Email; } + set + { + if (_data.Email != value) + { + _data.Email = value; + RaisePropertyChanged(EmailProperty); + IsChanged = true; + } + + ClearError(EmailProperty); + var validationResult = _validator.Validate(this, EmailProperty); + if (!validationResult.IsValid) + validationResult.Errors.ToList().ForEach(x => SetError(EmailProperty, x.ErrorMessage)); + } + } + + private const string DateOfBirthProperty = "DateOfBirth"; + public DateTime? DateOfBirth + { + get { return _data.DateOfBirth; } + set + { + if (_data.DateOfBirth != value) + { + _data.DateOfBirth = value; + RaisePropertyChanged(DateOfBirthProperty); + IsChanged = true; + } + + ClearError(DateOfBirthProperty); + var validationResult = _validator.Validate(this, DateOfBirthProperty); + if (!validationResult.IsValid) + validationResult.Errors.ToList().ForEach(x => SetError(DateOfBirthProperty, x.ErrorMessage)); + } + } + + private const string DescriptionProperty = "Description"; + public string Description + { + get { return _data.Description; } + set + { + if (_data.Description != value) + { + _data.Description = value; + RaisePropertyChanged(DescriptionProperty); + IsChanged = true; + } + + ClearError(DescriptionProperty); + var validationResult = _validator.Validate(this, DescriptionProperty); + if (!validationResult.IsValid) + validationResult.Errors.ToList().ForEach(x => SetError(DescriptionProperty, x.ErrorMessage)); + } + } + + #endregion + + #region Commands + + public ICommand OkCommand { get; set; } + public ICommand CancelCommand { get; set; } + + private void OkCommandExecute(object obj) + { + RefreshToViewErrors(); + + if (IsChanged && !HasErrors) + { + // save here + Messenger.Default.Send( + new UserViewResponseMessage() { UserViewModel = this }); + } + } + + // in case user hasn't touched the form + private void RefreshToViewErrors() + { + Username = _data.Username; + Password = _data.Password; + Email = _data.Email; + DateOfBirth = _data.DateOfBirth; + } + + private void CancelCommandExecute(object obj) + { + Messenger.Default.Send( + new UserViewResponseMessage() { UserViewModel = null }); + } + + #endregion + + private void ResetFormData() + { + SetProperties(_backup); + ClearAllErrors(); + IsChanged = false; + } + + public bool IsChanged { get; private set; } + + #region IEditableObject for datagrid + + private bool inEdit; + public void BeginEdit() + { + if (inEdit) return; + inEdit = true; + } + + public void CancelEdit() + { + if (!inEdit) return; + inEdit = false; + ResetFormData(); + } + + public void EndEdit() + { + if (!inEdit) return; + } + + #endregion + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.PL/ViewModels/ViewModelBase.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.PL/ViewModels/ViewModelBase.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,73 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; + +namespace SilverlightValidation.ViewModels +{ + public class ViewModelBase : INotifyPropertyChanged, INotifyDataErrorInfo + { + #region INotifyPropertyChanged method plus event + + public event PropertyChangedEventHandler PropertyChanged = delegate { }; + + protected void RaisePropertyChanged(string propertyName) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + + #endregion + + #region INotifyDataErrorInfo methods and helpers + + private readonly Dictionary> _errors = new Dictionary>(); + + public void SetError(string propertyName, string errorMessage) + { + if (!_errors.ContainsKey(propertyName)) + _errors.Add(propertyName, new List { errorMessage }); + + RaiseErrorsChanged(propertyName); + } + + protected void ClearError(string propertyName) + { + if (_errors.ContainsKey(propertyName)) + { + _errors.Remove(propertyName); + RaiseErrorsChanged(propertyName); + } + } + + protected void ClearAllErrors() + { + var errors = _errors.Select(error => error.Key).ToList(); + + foreach (var propertyName in errors) + ClearError(propertyName); + } + + public void RaiseErrorsChanged(string propertyName) + { + ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName)); + } + + public event EventHandler ErrorsChanged = delegate { }; + + public IEnumerable GetErrors(string propertyName) + { + if (propertyName == null) return null; + return _errors.ContainsKey(propertyName) + ? _errors[propertyName] + : null; + } + + public bool HasErrors + { + get { return _errors.Count > 0; } + } + + #endregion + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/Properties/AppManifest.xml --- a/SilverlightValidation/SilverlightValidation.Tests/Properties/AppManifest.xml Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/Properties/AssemblyInfo.cs --- a/SilverlightValidation/SilverlightValidation.Tests/Properties/AssemblyInfo.cs Sat May 05 11:07:41 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation.Tests/Properties/AssemblyInfo.cs Sat May 05 13:29:56 2012 +0100 @@ -1,6 +1,4 @@ -// Copyright © 2012 - -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -22,7 +20,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1196b633-7f87-485e-bd47-f3d2943a59e4")] +[assembly: Guid("843ea0ec-635f-4592-b3e6-5893be73bc5e")] // Version information for an assembly consists of the following four values: // @@ -31,7 +29,8 @@ // Build Number // Revision // -// You can specify all the values or you can default the Revision and Build Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/SilverlightValidation.Tests.csproj --- a/SilverlightValidation/SilverlightValidation.Tests/SilverlightValidation.Tests.csproj Sat May 05 11:07:41 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation.Tests/SilverlightValidation.Tests.csproj Sat May 05 13:29:56 2012 +0100 @@ -3,124 +3,59 @@ Debug AnyCPU - 9.0.30729 + 8.0.30703 2.0 - {12AE7560-AD64-4635-8A6B-772256FF0EDD} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + {02CCF8C7-1311-453F-BF82-3564AD9E7B8C} Library Properties SilverlightValidation.Tests SilverlightValidation.Tests - Silverlight - v5.0 - $(TargetFrameworkVersion) - true - - true - true - SilverlightValidation.Tests.xap - Properties\AppManifest.xml - SilverlightValidation.Tests.App - TestPage.html - true - true - false - Properties\OutOfBrowserSettings.xml - false - true - - - - - - - v3.5 + v4.0 + 512 true full false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT - true - true + bin\Debug\ + DEBUG;TRACE prompt 4 pdbonly true - Bin\Release - TRACE;SILVERLIGHT - true - true + bin\Release\ + TRACE prompt 4 - - ..\Libs\Microsoft.Silverlight.Testing.dll - - - ..\Libs\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll - - - ..\Libs\NUnit.Silverlight.Compatibility.dll + + ..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll - - ..\Libs\NUnit.Silverlight.Framework.dll - - - ..\Libs\NUnit.Silverlight.Metadata.dll - - - - + - + + + + - + - - - - - - - - - {0C1CC1FC-915A-4428-8952-CDC79EABC3F4} - SilverlightValidation - + - + - - - - - - - - - - + + \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserListViewModel.cs --- a/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserListViewModel.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - -using NUnit.Framework; - -namespace SilverlightValidation.Tests.ViewModels -{ - [TestFixture] - public class UserListViewModelTests - { - [Test] - public void Given_When_Then() - { - Assert.True(true); - } - } -} \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserListViewModelTests.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserListViewModelTests.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,15 @@ +using System; +using NUnit.Framework; + +namespace SilverlightValidation.Tests.ViewModels +{ + [TestFixture] + class UserListViewModelTests + { + [Test] + public void Given_When_Then() + { + Assert.True(true); + } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel.cs --- a/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - -using NUnit.Framework; - -namespace SilverlightValidation.Tests.ViewModels -{ - [TestFixture] - public class UserViewModelTests - { - [Test] - public void Given_When_Then() - { - Assert.True(true); - } - } -} \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModelTests.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModelTests.cs Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,14 @@ +using NUnit.Framework; + +namespace SilverlightValidation.Tests.ViewModels +{ + [TestFixture] + class UserViewModelTests + { + [Test] + public void Given_When_Then() + { + Assert.True(true); + } + } +} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.Tests/packages.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SilverlightValidation/SilverlightValidation.Tests/packages.config Sat May 05 13:29:56 2012 +0100 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation.sln --- a/SilverlightValidation/SilverlightValidation.sln Sat May 05 11:07:41 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation.sln Sat May 05 13:29:56 2012 +0100 @@ -5,7 +5,9 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightValidation.Web", "SilverlightValidation.Web\SilverlightValidation.Web.csproj", "{E65C6757-932B-4D01-9A8A-6D02F8FAA25A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightValidation.Tests", "SilverlightValidation.Tests\SilverlightValidation.Tests.csproj", "{12AE7560-AD64-4635-8A6B-772256FF0EDD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightValidation.PL", "SilverlightValidation.PL\SilverlightValidation.PL.csproj", "{13B5F568-F402-4A2A-9A23-0FDF0B5564E3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightValidation.Tests", "SilverlightValidation.Tests\SilverlightValidation.Tests.csproj", "{02CCF8C7-1311-453F-BF82-3564AD9E7B8C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,10 +23,14 @@ {E65C6757-932B-4D01-9A8A-6D02F8FAA25A}.Debug|Any CPU.Build.0 = Debug|Any CPU {E65C6757-932B-4D01-9A8A-6D02F8FAA25A}.Release|Any CPU.ActiveCfg = Release|Any CPU {E65C6757-932B-4D01-9A8A-6D02F8FAA25A}.Release|Any CPU.Build.0 = Release|Any CPU - {12AE7560-AD64-4635-8A6B-772256FF0EDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {12AE7560-AD64-4635-8A6B-772256FF0EDD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {12AE7560-AD64-4635-8A6B-772256FF0EDD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {12AE7560-AD64-4635-8A6B-772256FF0EDD}.Release|Any CPU.Build.0 = Release|Any CPU + {13B5F568-F402-4A2A-9A23-0FDF0B5564E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13B5F568-F402-4A2A-9A23-0FDF0B5564E3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13B5F568-F402-4A2A-9A23-0FDF0B5564E3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13B5F568-F402-4A2A-9A23-0FDF0B5564E3}.Release|Any CPU.Build.0 = Release|Any CPU + {02CCF8C7-1311-453F-BF82-3564AD9E7B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02CCF8C7-1311-453F-BF82-3564AD9E7B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02CCF8C7-1311-453F-BF82-3564AD9E7B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02CCF8C7-1311-453F-BF82-3564AD9E7B8C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/Commands/RelayCommand.cs --- a/SilverlightValidation/SilverlightValidation/Commands/RelayCommand.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -using System; -using System.Windows.Input; - -namespace SilverlightValidation.Commands -{ - public class RelayCommand : ICommand - { - public event EventHandler CanExecuteChanged = delegate { }; - - readonly Action _execute; - readonly Predicate _canExecute; - - public RelayCommand(Action execute, - Predicate canExecute = null) - { - if (execute == null) throw new ArgumentNullException("execute"); - - _execute = execute; - _canExecute = canExecute; - } - - - public void UpdateCanExecuteCommand() - { - CanExecuteChanged(this, new EventArgs()); - } - - - public bool CanExecute(object parameter) - { - return _canExecute == null || _canExecute(parameter); - } - - - public void Execute(object parameter) - { - _execute(parameter); - } - } -} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/Data/Factory.cs --- a/SilverlightValidation/SilverlightValidation/Data/Factory.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using SilverlightValidation.Models; - -namespace SilverlightValidation.Data -{ - public class Factory - { - public static IList CreateUserModels() - { - return new List(5) - { - new UserModel() { Username = "StevenH", Password = "Password1", Email = "steven@hotmail.com", DateOfBirth = new DateTime(1977, 09, 01), Description = ""}, - new UserModel() { Username = "RichardJ", Password = "12N456a", Email = "dicky@gmail.com", DateOfBirth = new DateTime(1983, 03, 13), Description = "Loves .Net!"}, - new UserModel() { Username = "BobbyP", Password = "pa33Word", Email = "bob@yahoo.co.uk", DateOfBirth = new DateTime(1992, 08, 30), Description = ""}, - new UserModel() { Username = "DavidM", Password = "poIu789", Email = "daveyboy@marsh.com", DateOfBirth = new DateTime(1965, 06, 21), Description = "Java fan boy"}, - new UserModel() { Username = "JessieJ", Password = "jlkJh567", Email = "jj@apple.co.uk", DateOfBirth = new DateTime(1990, 10, 15), Description = ""} - }; - } - } -} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/Diagrams/Overview.cd --- a/SilverlightValidation/SilverlightValidation/Diagrams/Overview.cd Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ - - - - - - AAAAAAAAACAgAAAAAQAAAAAAAAAQAEACAAAAAAAAABA= - Models\UserModel.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAA= - Validators\UserModelValidator.cs - - - - - - AAAAAAAAAAAAAAECAAAAAAAAAAAAABAYABEACAAAAAA= - ViewModels\UserListViewModel.cs - - - - - - UAAAoIAADCIgAAAAMYAACAAAAAAQABAKQEAAAAAgIAA= - ViewModels\UserViewModel.cs - - - - - - - AAAAAAACAABQAAABAAAAAgAAgAAAAACIAAAAAAARAAA= - ViewModels\ViewModelBase.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA= - Messages\UserViewResponseMessage.cs - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA= - Interfaces\ICloneable.cs - - - - - - AAAAAAAAACAgAAAAAQAAAAAAAAAQAAACAAAAAAAAAAA= - Interfaces\IUserModel.cs - - - - \ No newline at end of file diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/Interfaces/ICloneable.cs --- a/SilverlightValidation/SilverlightValidation/Interfaces/ICloneable.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -namespace SilverlightValidation.Interfaces -{ - public interface ICloneable - { - T Clone(); - } -} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/Interfaces/IUserModel.cs --- a/SilverlightValidation/SilverlightValidation/Interfaces/IUserModel.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -using System; -namespace SilverlightValidation.Interfaces -{ - public interface IUserModel - { - string Username { get; set; } - string Email { get; set; } - string Password { get; set; } - DateTime? DateOfBirth { get; set; } - string Description { get; set; } - } -} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/Messages/UserViewResponseMessage.cs --- a/SilverlightValidation/SilverlightValidation/Messages/UserViewResponseMessage.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -using GalaSoft.MvvmLight.Messaging; -using SilverlightValidation.ViewModels; - -namespace SilverlightValidation.Messages -{ - public class UserViewResponseMessage : MessageBase - { - public UserViewModel UserViewModel { get; set; } - } -} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/Models/UserModel.cs --- a/SilverlightValidation/SilverlightValidation/Models/UserModel.cs Sat May 05 11:07:41 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -using System; -using System.ComponentModel; -using SilverlightValidation.Interfaces; - -namespace SilverlightValidation.Models -{ - public class UserModel : IUserModel, ICloneable - { - public string Username { get; set; } - public string Email { get; set; } - public string Password { get; set; } - public DateTime? DateOfBirth { get; set; } - public string Description { get; set; } - - public static UserModel Create() - { - return new UserModel() { Username = "", Email = "", Password = "", DateOfBirth = null, Description = "" }; - } - - public UserModel Clone() - { - return (UserModel) this.MemberwiseClone(); - } - } -} diff -r 64e9903703a3 -r 188f8b366e87 SilverlightValidation/SilverlightValidation/SilverlightValidation.csproj --- a/SilverlightValidation/SilverlightValidation/SilverlightValidation.csproj Sat May 05 11:07:41 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation/SilverlightValidation.csproj Sat May 05 13:29:56 2012 +0100 @@ -63,16 +63,7 @@ ..\Libs\FluentValidation.dll - - False - ..\Libs\GalaSoft.MvvmLight.Extras.SL5.dll - - - False - ..\Libs\GalaSoft.MvvmLight.SL5.dll - - @@ -95,23 +86,13 @@ App.xaml - - - - - - - - UserListView.xaml UserView.xaml - - @@ -128,10 +109,14 @@ - - + + + {13B5F568-F402-4A2A-9A23-0FDF0B5564E3} + SilverlightValidation.PL + +