public void TestCreateListItem(Enums.ResourceType resourceType, WriteInvalidMemoInput valueType, int expectedCode)
        {
            var error = PhaseHelper.WritePhasesFail(new List <Phase> {
                CreateSinglePhaseInstance(resourceType, valueType, 0), CreateSinglePhaseInstance(resourceType, valueType, 1)
            });

            Assert.That(error, Is.Not.Null, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType));
            Assert.That(error.Code, Is.EqualTo(expectedCode), Enums.Message.WRONG_ERROR_CODE);
        }
        public void TestCreateListItem(string fieldName, WriteInvalidResourceInput valueType, int expectedCode)
        {
            var phase = CreateSinglePhaseInstance(fieldName, valueType);
            var error = PhaseHelper.WritePhasesFail(new List <Phase> {
                phase, phase
            });

            Assert.That(error, Is.Not.Null, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, defaultResource));
            Assert.That(error.Code, Is.EqualTo(expectedCode), Enums.Message.WRONG_ERROR_CODE);
        }
Example #3
0
        public void TestUpdateListItem(ResourceType resourceType, string fieldName, string fieldValue, int expectedCode)
        {
            var resourceList = new[] { 0, 1 }.Select(depKey =>
            {
                var phase = new Phase {
                    Id = phaseEntryReader.Data[$"{resourceType.ToPrivateEnum()}{depKey}"].First().Id
                };
                phase.DictionaryValues[fieldName] = fieldValue;
                return(phase);
            });

            ErrorCode result = PhaseHelper.WritePhasesFail(resourceList);

            Assert.That(result, MustBe.MatchingErrorCode(expectedCode), Enums.Message.WRONG_ERROR_CODE);
        }
Example #4
0
        public void TestCreateListItem(ResourceType resourceType, string fieldName, string fieldValue, int expectedCode)
        {
            var resourceList = new[] { 0, 1 }.Select(depKey =>
            {
                var phase = PhaseHelper.CreatePhaseInstance(records, resourceType, depKey);
                phase.DictionaryValues[fieldName] = fieldValue;

                return(phase);
            }).ToList();

            ErrorCode result = PhaseHelper.WritePhasesFail(resourceList);

            Assert.That(result, Is.Not.Null, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType));
            Assert.That(result.Code, Is.EqualTo(expectedCode), Enums.Message.WRONG_ERROR_CODE);
        }
Example #5
0
        public void TestUpdateListItem(Enums.ResourceType resourceType, string fieldName, WriteInvalidInput valueType, int expectedCode)
        {
            string fieldValue = FieldValueMapper.InvalidMapper[valueType];
            var    resourceList = new[] { 0, 1 }.Select(depKey =>
            {
                var phase = new Phase {
                    Id = ReadPhaseBasedOnResource(resourceType, depKey)
                };
                phase.DictionaryValues[fieldName] = fieldValue;
                return(phase);
            });

            ErrorCode result = PhaseHelper.WritePhasesFail(resourceList);

            Assert.That(result, MustBe.MatchingErrorCode(expectedCode), Enums.Message.WRONG_ERROR_CODE);
        }
        public void TestUpdateListItem(Enums.ResourceType resourceType, InvalidPhaseOption valueType, int expectedCode)
        {
            object fieldValue = GetOptionValue(valueType, resourceType);
            var    resourceList = new[] { 0, 1 }.Select(depKey =>
            {
                var phase = new Phase {
                    Id = ReadPhaseBasedOnResource(resourceType, depKey), Date = Util.ToString(DateTime.Now)
                };
                phase.PhaseObject = fieldValue;
                return(phase);
            });

            ErrorCode result = PhaseHelper.WritePhasesFail(resourceList);

            Assert.That(result, MustBe.MatchingErrorCode(expectedCode), Enums.Message.WRONG_ERROR_CODE);
        }
        public void TestCreateListItem(Enums.ResourceType resourceType, InvalidPhaseOption valueType, int expectedCode)
        {
            object fieldValue = GetOptionValue(valueType, resourceType);

            var resourceList = new[] { 0, 1 }.Select(depKey =>
            {
                var phase = PhaseHelper.CreatePhaseInstance(creatingRecords, resourceType, depKey);

                phase.PhaseObject = fieldValue;

                return(phase);
            }).ToList();

            ErrorCode result = PhaseHelper.WritePhasesFail(resourceList);

            Assert.That(result, Is.Not.Null, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType));
            Assert.That(result.Code, Is.EqualTo(expectedCode), Enums.Message.WRONG_ERROR_CODE);
        }