public void Map_GivenMappedReturnsAreEditableButThereIsAnInProgressReturnInComplianceYearAndQuarter_ReturnedShouldNotBeEditable()
        {
            var returnData = A.CollectionOfFake <ReturnData>(1).ToList();

            var returnsItems = new List <ReturnsItemViewModel>()
            {
                new ReturnsItemViewModel()
                {
                    ReturnViewModel = new ReturnViewModel(new ReturnData()
                    {
                        Quarter = new Quarter(2019, QuarterType.Q1), QuarterWindow = QuarterWindowTestHelper.GetDefaultQuarterWindow()
                    }, new List <AatfObligatedData>(), A.Fake <OrganisationData>(), new TaskListDisplayOptions()),
                    ReturnsListDisplayOptions = new ReturnsListDisplayOptions()
                    {
                        DisplayContinue = true
                    }
                },
                new ReturnsItemViewModel()
                {
                    ReturnViewModel = new ReturnViewModel(new ReturnData()
                    {
                        Quarter = new Quarter(2019, QuarterType.Q1), QuarterWindow = QuarterWindowTestHelper.GetDefaultQuarterWindow()
                    }, new List <AatfObligatedData>(), A.Fake <OrganisationData>(), new TaskListDisplayOptions()),
                    ReturnsListDisplayOptions = new ReturnsListDisplayOptions()
                    {
                        DisplayEdit = true
                    }
                }
            };

            A.CallTo(() => ordering.Order(A <List <ReturnData> > ._)).Returns(returnData);
            A.CallTo(() => returnItemViewModelMap.Map(A <ReturnData> ._)).ReturnsNextFromSequence(returnsItems.ToArray());

            var returnsData = new ReturnsData(returnData, null, A.Fake <List <Quarter> >(), QuarterWindowTestHelper.GetDefaultQuarterWindow(),
                                              DateTime.Now);

            var result = returnsMap.Map(new ReturnToReturnsViewModelTransfer()
            {
                ReturnsData = returnsData
            });

            result.Returns.Count(r => r.ReturnsListDisplayOptions.DisplayEdit).Should().Be(0);
        }
Exemple #2
0
        private void OrderReturns(ReturnsData source, ReturnsViewModel model)
        {
            var orderedItems = ordering.Order(source.ReturnsList);

            foreach (var @return in orderedItems)
            {
                var returnViewModelItems = returnItemViewModelMap.Map(@return);

                model.Returns.Add(returnViewModelItems);
            }
        }