예제 #1
0
        public void UpdateNoteTest()
        {
            // Initialize notes
            var customer   = _util.GetAuthorizedCustomerDTO();
            var notesToAdd = new List <NoteDTO>
            {
                _util.BuildDefaultNoteDTO(),
                _util.BuildDefaultNoteDTO(),
                _util.BuildDefaultNoteDTO()
            };
            var addedNotes = notesToAdd.Select(note => _client.AddNote(note, customer.Guid)).ToList();

            // Update notes
            const string customTextAndTitle = "myCustomTextAndTitle";

            foreach (var aNote in addedNotes)
            {
                aNote.Title = customTextAndTitle;
                aNote.Text  = customTextAndTitle;
                _client.UpdateNote(aNote);
            }

            // Check notes
            var customersNotes       = _util.GetCustomersNotes(customer).ToList();
            var hasEditedNoteResults = addedNotes.Select(aNote =>
                                                         customersNotes.Any(n =>
                                                                            n.Title.Equals(aNote.Title) && n.Text.Equals(aNote.Text)
                                                                            )
                                                         );

            foreach (var hasEditedNote in hasEditedNoteResults)
            {
                Assert.IsTrue(hasEditedNote);
            }

            var hasNoOtherNotes = customersNotes.Count.Equals(addedNotes.Count);

            Assert.IsTrue(hasNoOtherNotes);
        }
예제 #2
0
 public NoteDTO UpdateNote(NoteDTO note)
 {
     return(ToClientDTO(_client.UpdateNote(ToServiceDTO(note))));
 }