public void ShouldGetToDoItemsWithoutUserAndState()
        {
            var getToDoItemInput = new GetToDoItemInput
            {
                AssignedUserId = null,
                State = null
            };

            var toDoItems = this.CreateToDoItems(NumberOfToDoItemsToCreate).AsQueryable();
            toDoItems.ToList().ForEach(
                toDoItem =>
                {
                    toDoItem.AssignedUserId = Guid.NewGuid().ToString();
                    toDoItem.State = (ToDoItemState)this.enumGenerator.Next(0, Enum.GetValues(typeof(ToDoItemState)).Length);
                });

            using (this.Repository.Record())
            {
                Expect.Call(() => this.Logger.Info(Arg.Text.Contains("Getting ToDoItems for input:")));
                Expect.Call(this.DbContextScopeFactory.CreateReadOnly());
                Expect.Call(this.ToDoItemRepository.GetAll()).Return(toDoItems);
                Expect.Call(this.Mapper.Map<ToDoItemState>(null)).Constraints(Is.Anything()).Repeat.Never();
                Expect.Call(this.Mapper.Map<List<ToDoItemDto>>(Arg<List<ToDoItem>>.List.Count(Is.Equal(toDoItems.Count()))));
                Expect.Call(() => this.Logger.Info(Arg.Text.Contains("Got ToDoItems output:")));
            }

            using (this.Repository.Playback())
            {
                var toDoItemApplicationService = new ToDoItemApplicationService(
                    this.ToDoItemRepository,
                    this.UserRepository,
                    this.DbContextScopeFactory,
                    this.Mapper,
                    this.Logger);

                toDoItemApplicationService.GetToDoItems(getToDoItemInput);
            }
        }
        public void ShouldGetToDoItemsWithUserAndState()
        {
            var getToDoItemInput = new GetToDoItemInput
            {
                AssignedUserId = Guid.NewGuid().ToString(),
                State = (Perfectial.Application.Model.ToDoItemState)this.enumGenerator.Next(0, Enum.GetValues(typeof(Perfectial.Application.Model.ToDoItemState)).Length)
            };

            Assert.IsNotNull(getToDoItemInput.State);
            var toDoItemState = (ToDoItemState)getToDoItemInput.State;

            var index = 0;
            var toDoItems = this.CreateToDoItems(NumberOfToDoItemsToCreate).AsQueryable();
            toDoItems.ToList().ForEach(
                toDoItem =>
                    {
                        if (index++ % 2 == 1)
                        {
                            toDoItem.AssignedUserId = getToDoItemInput.AssignedUserId;
                            toDoItem.State = toDoItemState;
                        }
                        else
                        {
                            while (toDoItem.State == toDoItemState)
                            {
                                toDoItem.State = (ToDoItemState)this.enumGenerator.Next(0, Enum.GetValues(typeof(ToDoItemState)).Length);
                            }
                        }
                    });

            using (this.Repository.Record())
            {
                Expect.Call(() => this.Logger.Info(Arg.Text.Contains("Getting ToDoItems for input:")));
                Expect.Call(this.DbContextScopeFactory.CreateReadOnly());
                Expect.Call(this.ToDoItemRepository.GetAll()).Return(toDoItems);
                Expect.Call(this.Mapper.Map<ToDoItemState>(null)).Constraints(Is.Equal(getToDoItemInput.State)).Return(toDoItemState).Repeat.AtLeastOnce();
                Expect.Call(this.Mapper.Map<List<ToDoItemDto>>(Arg<List<ToDoItem>>.List.Count(Is.Equal(toDoItems.Count() / 2))));
                Expect.Call(() => this.Logger.Info(Arg.Text.Contains("Got ToDoItems output:")));
            }

            using (this.Repository.Playback())
            {
                var toDoItemApplicationService = new ToDoItemApplicationService(
                    this.ToDoItemRepository,
                    this.UserRepository,
                    this.DbContextScopeFactory,
                    this.Mapper,
                    this.Logger);
                toDoItemApplicationService.GetToDoItems(getToDoItemInput);
            }
        }