public void TestUpdateSingleItem(Enums.ResourceType resourceType, PhaseDateInput phaseDateType, PhaseOptionInput phaseOptionType, int expectedCode, int index)
        {
            phaseDictionary = PhaseFieldHelper.InitPhaseList(phaseSearcher);
            var resource = PhaseFieldHelper.GetUpdatedResourcePhaseField(resourceType, phaseDateType, phaseOptionType, index,
                                                                         phaseSearcher, phaseEntryReader, GetPhaseOrderBySort(resourceType), phaseDictionary, records);
            string result = ResourceHelper.WriteResource(resource, null);

            Assert.That(result, MustBe.EqualTo(records.Data[$"{resourceType.ToPrivateEnum()}{index}"].Id.ToString()), string.Format("Cannot update phase for {0}", resourceType));
        }
        public void TestUpdateSingleItem(Enums.ResourceType resourceType, PhaseDateInput phaseDateType, PhaseOptionInput phaseOptionType, int expectedCode)
        {
            phaseDictionary = PhaseFieldHelper.InitPhaseList(phaseSearcher);
            var resource = PhaseFieldHelper.GetUpdatedResourcePhaseField(resourceType, phaseDateType, phaseOptionType, 0,
                                                                         phaseSearcher, phaseEntryReader, GetPhaseOrderBySort(resourceType), phaseDictionary, records);
            ErrorCode result = ResourceHelper.WriteResourceFail(resource, null);

            Assert.That(result, MustBe.MatchingErrorCode(expectedCode), string.Format("Cannot create phase for {0}", resourceType));
        }
        public void TestUpdateListItem(Enums.ResourceType resourceType, PhaseDateInput phaseDateType, PhaseOptionInput phaseOptionType, int expectedCode, int index)
        {
            phaseDictionary = PhaseFieldHelper.InitPhaseList(phaseSearcher);
            var resourceList = new int[] { (index * 2), (index * 2 + 1) }.Select(keyDep =>
            {
                return(PhaseFieldHelper.GetUpdatedResourcePhaseField(resourceType, phaseDateType, phaseOptionType, keyDep,
                                                                     phaseSearcher, phaseEntryReader, GetPhaseOrderBySort(resourceType), phaseDictionary, records));
            }).ToList();

            List <WriteResultItem> result = ResourceHelper.WriteResources(resourceType, resourceList, null);

            Assert.That(result, MustBe.SuccessfullyWritten(2), string.Format("Cannot update phase for {0}", resourceType));
        }
        public void TestUpdateListItem(Enums.ResourceType resourceType, PhaseDateInput phaseDateType, PhaseOptionInput phaseOptionType, int expectedCode)
        {
            phaseDictionary = PhaseFieldHelper.InitPhaseList(phaseSearcher);
            var resourceList = new int[] { 0, 1 }.Select(keyDep =>
            {
                return(PhaseFieldHelper.GetUpdatedResourcePhaseField(resourceType, phaseDateType, phaseOptionType, keyDep,
                                                                     phaseSearcher, phaseEntryReader, GetPhaseOrderBySort(resourceType), phaseDictionary, records));
            }).ToList();

            ErrorCode result = ResourceHelper.WriteResourcesFail(resourceList, null);

            Assert.That(result, MustBe.MatchingErrorCode(expectedCode), string.Format("Cannot create phase for {0}", resourceType));
        }