예제 #1
0
        public void CypherQueryBuilderServicGetPropertyValueReturnsExceptionForNullItem()
        {
            //arrange
            var item         = new GraphPredictedYearModel();
            var propertyInfo = item.GetType().GetProperty(nameof(GraphPredictedYearModel.Soc));

            //act
            var exceptionResult = Assert.Throws <ArgumentNullException>(() => cypherQueryBuilderService.GetPropertyValue(null, propertyInfo));

            //assert
            Assert.Equal("Value cannot be null. (Parameter 'item')", exceptionResult.Message);
        }
예제 #2
0
        public void CypherQueryBuilderServiceGetPropertyValueReturnsSuccess(int soc, string createdDate, string employment, string measure, string fieldName, string expectedResult)
        {
            //arrange
            var item = new GraphPredictedYearModel
            {
                Soc         = soc,
                CreatedDate = DateTime.Parse(createdDate, CultureInfo.InvariantCulture),
                Employment  = decimal.Parse(employment, CultureInfo.InvariantCulture),
                Measure     = measure,
            };
            var propertyInfo = item.GetType().GetProperty(fieldName);

            //act
            var result = cypherQueryBuilderService.GetPropertyValue(item, propertyInfo);

            //assert
            Assert.Equal(expectedResult, result);
        }