Example #1
0
 public void UpdateNoteEntity(Note note, NoteModel noteModel)
 {
     note.Title = noteModel.Title;
     note.Message = noteModel.Message;
     note.Price = noteModel.Price;
     note.EmailAddress = new EmailAddress(noteModel.Email);
 }
Example #2
0
 public void UpdateNoteEntity(Note note, NoteModel noteModel)
 {
     Contract.Requires<ArgumentNullException>(note != null);
     Contract.Requires<ArgumentNullException>(noteModel != null);
     Contract.Requires<ArgumentException>(noteModel.CategoryId != Guid.Empty, "Note requires a category to belong to.");
     Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(noteModel.Title), "Note requires a title.");
     Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(noteModel.Message), "Note requires a message body.");
     Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(noteModel.Email), "Note requires an email address.");
     Contract.Requires<ArgumentException>(note.Id == noteModel.Id, "Id's of note and note model should match.");
     throw new NotImplementedException();
 }
Example #3
0
 public NoteModel ToClientNoteModel(Note note)
 {
     return new NoteModel
     {
         CategoryId = note.Category.Id,
         Id = note.Id,
         Title = note.Title,
         Message = note.Message,
         Price = note.Price,
         Email = note.EmailAddress.Value
     };
 }
Example #4
0
        public Note Build()
        {
            string title = _title.GetValueOrDefault(Some.String());
            string message = _message.GetValueOrDefault(Some.Sentence());
            EmailAddress email = _email.GetValueOrDefault(new EmailAddress(Some.EmailAddress()));
            Category category = _category.GetValueOrDefault();

            var note =  new Note(title, message, null, email);

            if( category != null )
                category.Notes.Add(note);

            return note;
        }
Example #5
0
 public NoteModel ToClientNoteModel(Note note)
 {
     Contract.Requires<ArgumentNullException>(note != null);
     Contract.Ensures(Contract.Result<NoteModel>() != null);
     throw new NotImplementedException();
 }