Exemple #1
0
        public void EqualResponsibleParty()
        {
            var srcResponsibleParty = UserSummaryViewmodelFactory.Create(srcTodoItem.ResponsibleParty);

            resultFields.ResponsibleParty.UserName.ShouldBe(srcResponsibleParty.UserName);
            resultFields.ResponsibleParty.Email.ShouldBe(srcResponsibleParty.Email);
        }
        public WhenUserIsConvertedToUserSummaryView()
        {
            user       = new IdentityUser("*****@*****.**");
            user.Email = "[email protected]";


            resultFields = UserSummaryViewmodelFactory.Create(user);
        }
        public static TodoListSummaryViewmodel Create(TodoList todoList)
        {
            var numberOfNotDoneItems = todoList.Items.Count(ti => !ti.IsDone);

            return(new TodoListSummaryViewmodel(
                       todoList.TodoListId,
                       todoList.Title,
                       numberOfNotDoneItems,
                       UserSummaryViewmodelFactory.Create(todoList.Owner)));
        }
        public static TodoListSummaryViewmodel Create(TodoList todoList, string userId)
        {
            var numberOfNotDoneItems = todoList.Items.Where(i => todoList.Owner.Id == userId || i.ResponsiblePartyId == userId).Count(ti => !ti.IsDone);

            return(new TodoListSummaryViewmodel(todoList.TodoListId, todoList.Title, numberOfNotDoneItems, UserSummaryViewmodelFactory.Create(todoList.Owner)));
        }