public ListModel ReadList(UserProfile user, UserSelectedContext catalogInfo, bool headerOnly)
        {
            ListModel list = null;

            ReminderItemsListHeader header = _headersRepo.GetReminderItemsHeader(catalogInfo);

            if (header == null)
            {
                list = null;
            }
            else
            {
                if (headerOnly)
                {
                    list = header.ToListModel();
                }
                else
                {
                    List <ReminderItemsListDetail> items = _detailsRepo.GetRemindersDetails(header.Id);

                    list = header.ToListModel(items);
                }
            }
            return(list);
        }
Beispiel #2
0
        public static ListModel ToListModel(this ReminderItemsListHeader header, List <ListItemModel> items)
        {
            ListModel retVal = header.ToListModel();

            retVal.Items = items.OrderBy(i => i.Position)
                           .ToList();
            return(retVal);
        }
Beispiel #3
0
        public static ListModel ToListModel(this ReminderItemsListHeader header, List <ReminderItemsListDetail> items)
        {
            ListModel retVal = header.ToListModel();

            if (items != null)
            {
                retVal.Items = items.Select(i => i.ToWebModel())
                               .OrderBy(i => i.Position)
                               .ToList();
            }

            return(retVal);
        }
Beispiel #4
0
            public void GoodHeader_ItemsIsNotNull()
            {
                // arrange
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.Items
                .Should()
                .NotBeNull();
            }
Beispiel #5
0
            public void GoodHeader_ItemsIsNotNull()
            {
                // arrange
                List <ListItemModel>    details = MakeListOfModels();
                ReminderItemsListHeader header  = MakeHeader();

                // act
                ListModel results = header.ToListModel(details);

                // assert
                results.Items
                .Should()
                .NotBeNull();
            }
Beispiel #6
0
            public void GoodHeader_ReturnsExpectedIsReminder()
            {
                // arrange
                bool expected = true;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.IsReminder
                .Should()
                .Be(expected);
            }
Beispiel #7
0
            public void GoodHeader_SharedWithIsNotNull()
            {
                // arrange
                ReminderItemsListHeader        header  = MakeHeader();
                List <ReminderItemsListDetail> details = MakeListOfDetails();

                // act
                ListModel results = header.ToListModel(details);

                // assert
                results.SharedWith
                .Should()
                .NotBeNull();
            }
Beispiel #8
0
            public void GoodHeader_ReturnsExpectedType()
            {
                // arrange
                ListType expected = ListType.Reminder;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.Type
                .Should()
                .Be(expected);
            }
Beispiel #9
0
            public void GoodHeader_ReturnsExpectedReadonly()
            {
                // arrange
                bool expected = false;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.ReadOnly
                .Should()
                .Be(expected);
            }
Beispiel #10
0
            public void GoodHeader_ReturnsExpectedName()
            {
                // arrange
                string expected = "Reminders";
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.Name
                .Should()
                .Be(expected);
            }
Beispiel #11
0
            public void GoodHeader_ReturnsExpectedListId()
            {
                // arrange
                int expected = 15;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.ListId
                .Should()
                .Be(expected);
            }
Beispiel #12
0
            public void GoodHeader_ReturnsExpectedCustomerNumber()
            {
                // arrange
                string expected = "123456";
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.CustomerNumber
                .Should()
                .Be(expected);
            }
Beispiel #13
0
            public void GoodHeader_ReturnsExpectedSharedWithCount()
            {
                // arrange
                int expected = 0;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.SharedWith
                .Count
                .Should()
                .Be(expected);
            }
Beispiel #14
0
            public void GoodHeader_ReturnsExpectedIsSharing()
            {
                // arrange
                bool expected = false;
                ReminderItemsListHeader        header  = MakeHeader();
                List <ReminderItemsListDetail> details = MakeListOfDetails();

                // act
                ListModel results = header.ToListModel(details);

                // assert
                results.IsSharing
                .Should()
                .Be(expected);
            }
Beispiel #15
0
            public void GoodHeader_ReturnsExpectedIsWorksheet()
            {
                // arrange
                List <ListItemModel> details = MakeListOfModels();
                bool expected = false;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel(details);

                // assert
                results.IsWorksheet
                .Should()
                .Be(expected);
            }
Beispiel #16
0
            public void GoodHeader_ReturnsExpectedBranchId()
            {
                // arrange
                List <ListItemModel> details = MakeListOfModels();
                string expected = "FUT";
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel(details);

                // assert
                results.BranchId
                .Should()
                .Be(expected);
            }
Beispiel #17
0
            public void GoodHeader_ItemsHasZeroCount()
            {
                // arrange
                int expected = 0;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel();

                // assert
                results.Items
                .Count
                .Should()
                .Be(expected);
            }
Beispiel #18
0
            public void GoodHeader_ItemsHasExpectedCount()
            {
                // arrange
                List <ListItemModel> details = MakeListOfModels();
                int expected = 2;
                ReminderItemsListHeader header = MakeHeader();

                // act
                ListModel results = header.ToListModel(details);

                // assert
                results.Items
                .Count
                .Should()
                .Be(expected);
            }