public static TTo To <TTo> ([NotNull] this IPersonColorPreferenceModel source) where TTo : class, IPersonColorPreferenceModel, new () { var result = new TTo( ); result.PopulateFrom(source); return(result); }
/// <inheritdoc /> public IPersonColorPreferenceModel PopulateFrom(IPersonColorPreferenceModel source) { DateOfBirth = source.DateOfBirth; FavoriteColor = source.FavoriteColor; FirstName = source.FirstName; Gender = source.Gender; LastName = source.LastName; return(this); }
/// <summary> /// Adds the specified modifiable. /// </summary> /// <param name="modifiable">The modifiable.</param> /// <returns>IPersonColorPreferenceModel.</returns> /// <inheritdoc /> public int Add(IPersonColorPreferenceModel modifiable) { var copy = new PersonColorPreferenceModel(modifiable); var newId = Interlocked.Increment(ref _recordsAdded); copy.Id = newId; _byId [newId] = copy; return(newId); }
/// <summary> /// Initializes a new instance of the <see cref="PersonColorPreferenceModel"/> class. /// </summary> /// <param name="source">The source.</param> public PersonColorPreferenceModel([NotNull] IPersonColorPreferenceModel source) { _dateOfBirth = source.DateOfBirth; _firstName = source.FirstName; _lastName = source.LastName; DateTimeBirth = source.DateTimeBirth; FirstNameUpper = source.FirstNameUpper; LastNameUpper = source.LastNameUpper; FavoriteColor = source.FavoriteColor; Gender = source.Gender; }
/// <summary> /// Asserts the record identical. /// </summary> /// <param name="target">The target.</param> /// <param name="added">The added.</param> /// <autogeneratedoc /> /// TODO Edit XML Comment Template for AssertRecordIdentical public static void AssertRecordIdentical([NotNull] PersonColorPreferenceModel target, [NotNull] IPersonColorPreferenceModel added) { // Record must have been copied Assert.False(ReferenceEquals(target, added)); Assert.Equal(added.FavoriteColor, target.FavoriteColor); Assert.Equal(added.FirstName, target.FirstName); Assert.Equal(added.Gender, target.Gender); Assert.Equal(added.LastName, target.LastName); Assert.Equal(added.DateOfBirth, target.DateOfBirth); }