public void NoteIsUpdatedInSessionWhenUpdateIsCalled()
        {
            var mockSession = new Mock<ISession>();
            NoteRepository noteRepository = new NoteRepository(mockSession.Object);

            Entities.Note note = new Entities.Note();
            noteRepository.Update(note);

            mockSession.Verify(x => x.Update(note), Times.Once());
        }
 public static Logic.Objects.Base_Objects.Note MapNote(Entities.Note contextNote)
 {
     Logic.Objects.Base_Objects.Note logicNote = new Logic.Objects.Base_Objects.Note()
     {
         noteID       = contextNote.NoteId,
         noteSubject  = contextNote.NoteSubject,
         noteContents = contextNote.NoteContents
     };
     return(logicNote);
 }
        public void EntityIsSavedInSessionWhenAddIsCalled()
        {
            var mockSession = new Mock<ISession>();

            NoteRepository noteRepository = new NoteRepository(mockSession.Object);
            Entities.Note note = new Entities.Note();
            noteRepository.Add(note);

            mockSession.Verify(x => x.Save(note), Times.Once());
        }
        public void EntityIsDeletedFromSessionWhenRemoveIsCalled()
        {
            var mockSession = new Mock<ISession>();
            NoteRepository noteRepository = new NoteRepository(mockSession.Object);

            Entities.Note note = new Entities.Note();
            noteRepository.Remove(note);

            mockSession.Verify(x => x.Delete(note), Times.Once());
        }
        public void HandleShouldRemoveNoteFromRepository()
        {
            var note = new Entities.Note();
            var removeNoteCommand = new RemoveNoteCommand(note);

            var mockRepository = new Mock<INoteRepository>();
            var removeNoteCommandHandler = new RemoveNoteCommandHandler(mockRepository.Object);

            removeNoteCommandHandler.Handle(removeNoteCommand);

            mockRepository.Verify(x => x.Remove(note), Times.Once());
        }
Exemple #6
0
        public static List <Entities.Note> ReadNotesXML(string xmlString)
        {
            StringBuilder        output = new StringBuilder();
            List <Entities.Note> result = new List <Entities.Note>();

            try
            {
                using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
                {
                    string nrZgloszenia = "";
                    string content      = "";
                    string author       = "";
                    string date         = "";

                    while (reader.Read())
                    {
                        if (reader.IsStartElement())
                        {
                            switch (reader.Name)
                            {
                            case "NrZgloszenia": reader.Read();
                                if (reader.NodeType == XmlNodeType.Text)
                                {
                                    nrZgloszenia = reader.Value;
                                }
                                break;

                            case "content": reader.Read();
                                if (reader.NodeType == XmlNodeType.Text)
                                {
                                    content = reader.Value;
                                }
                                break;

                            case "author": reader.Read();
                                if (reader.NodeType == XmlNodeType.Text)
                                {
                                    author = reader.Value;
                                }
                                break;

                            case "date": reader.Read();
                                if (reader.NodeType == XmlNodeType.Text)
                                {
                                    date = reader.Value;
                                }
                                break;
                            }
                        }
                        else
                        {
                            if (reader.Name == "r")
                            {
                                Entities.Note note = new Entities.Note()
                                {
                                    issueNumber = nrZgloszenia,
                                    author      = author,
                                    date        = date.Replace('T', ' '),
                                    content     = content
                                };

                                result.Add(note);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(result);
        }
Exemple #7
0
 public Entities.ResultValue <bool> UpdateNote(Entities.Note note)
 {
     return(base.Channel.UpdateNote(note));
 }
Exemple #8
0
 public Entities.ResultValue <bool> AddNote(Entities.Note note)
 {
     return(base.Channel.AddNote(note));
 }