public static NoteEntity MapToNoteEntity(this Note note)
        {
            NoteEntity noteEntity = null;

            if (note != null)
            {
                noteEntity = new NoteEntity(note.PartitionKey, note.RowKey)
                                {
                                    Title = note.Title,
                                    Content = note.Content,
                                    IsClosed = note.IsClosed,
                                    OrderingIndex = note.OrderingIndex,
                                    ContainerKeys = note.ContainerKeys
                                };
            }

            return noteEntity;
        }
        public void NotesRepositoryLoadNotesCallsLoadAndGetsFromTheUnitOfWork()
        {
            // Arrange
            var user = new User { PartitionKey = User1PartitionKey, RowKey = User1RowKey };
            var taskList = new TaskList("Test title", user) { PartitionKey = User1RowKey, RowKey = _taskList1RowKey };
            var note = new Note("Test title", "Test content", user, taskList) { PartitionKey = Note1PartitionKey, RowKey = _note1RowKey };
            var noteEntity = new NoteEntity(Note1PartitionKey, _note1RowKey);
            note.Share.Add(user);

            var unitOfWorkMock = new Mock<IUnitOfWork>();
            unitOfWorkMock.Setup(u => u.Load("TaskListNotes", It.IsAny<Expression<Func<TaskListNoteEntity, bool>>>())).Returns(BuildTaskListNotesTable());
            unitOfWorkMock.Setup(u => u.Get("Notes", It.IsAny<Expression<Func<NoteEntity, bool>>>())).Returns(noteEntity);
            var repository = new NotesRepository(unitOfWorkMock.Object);

            // Act
            repository.LoadNotes(taskList);

            // Assert
            unitOfWorkMock.Verify(uow => uow.Load("TaskListNotes", It.IsAny<Expression<Func<TaskListNoteEntity, bool>>>()), Times.Once());
            unitOfWorkMock.Verify(uow => uow.Get("Notes", It.IsAny<Expression<Func<NoteEntity, bool>>>()), Times.Exactly(2));
        }
        public void NotesRepositoryGetCallsGetFromTheUnitOfWorkAndReturnsAnExistingNote()
        {
            // Arrange
            var note = new NoteEntity(Note1PartitionKey, _note1RowKey);
            var unitOfWorkMock = new Mock<IUnitOfWork>();
            unitOfWorkMock.Setup(u => u.Get("Notes", It.IsAny<Expression<Func<NoteEntity, bool>>>())).Returns(note);
            var repository = new NotesRepository(unitOfWorkMock.Object);

            // Act
            var result = repository.Get(Note1PartitionKey, _note1RowKey);

            // Assert
            Assert.IsNotNull(result);
            unitOfWorkMock.Verify(uow => uow.Get("Notes", It.IsAny<Expression<Func<NoteEntity, bool>>>()), Times.Once());
        }