public bool FieldExists(string instrumentName, string serverParkName, FieldNameType fieldNameType) { instrumentName.ThrowExceptionIfNullOrEmpty("instrumentName"); serverParkName.ThrowExceptionIfNullOrEmpty("serverParkName"); return(_caseService.FieldExists(_connectionModel, instrumentName, serverParkName, fieldNameType)); }
public bool FieldExists(IDataRecord dataRecord, FieldNameType fieldNameType) { var dataRecord2 = (IDataRecord2)dataRecord; var dataFields = dataRecord2.GetDataFields(); return(dataFields.Any(f => f.FullName.Equals(fieldNameType.FullName(), StringComparison.InvariantCultureIgnoreCase))); }
public IDataValue GetFieldValue(string primaryKeyValue, string instrumentName, string serverParkName, FieldNameType fieldNameType) { primaryKeyValue.ThrowExceptionIfNullOrEmpty("primaryKeyValue"); instrumentName.ThrowExceptionIfNullOrEmpty("instrumentName"); serverParkName.ThrowExceptionIfNullOrEmpty("serverParkName"); var dataRecord = _caseService.GetDataRecord(_connectionModel, primaryKeyValue, instrumentName, serverParkName); return(GetFieldValue(dataRecord, fieldNameType)); }
public void Given_I_Call_FieldExists_Then_The_Correct_DataModel_Is_Returned(FieldNameType fieldNameType, bool exists) { //arrange _fieldServiceMock.Setup(f => f.FieldExists(_dataRecordMock.Object, fieldNameType)).Returns(exists); //act var result = _sut.FieldExists(_dataRecordMock.Object, fieldNameType); //assert Assert.AreEqual(exists, result); }
public void Given_I_Call_FieldExists_Then_The_Correct_Services_Are_Called(FieldNameType fieldNameType) { //arrange _fieldServiceMock.Setup(f => f.FieldExists(_dataRecordMock.Object, fieldNameType)).Returns(true); //act _sut.FieldExists(_dataRecordMock.Object, fieldNameType); //assert _fieldServiceMock.Verify(v => v.FieldExists(_dataRecordMock.Object, fieldNameType), Times.Once); }
public void Given_I_Call_GetField_Then_The_Correct_Field_Is_Returned(FieldNameType fieldNameType) { //arrange var fieldMock = new Mock <IField>(); var dataRecordMock = new Mock <IDataRecord>(); dataRecordMock.Setup(d => d.GetField(fieldNameType.FullName())).Returns(fieldMock.Object); //act var result = _sut.GetField(dataRecordMock.Object, fieldNameType); //assert Assert.AreEqual(fieldMock.Object, result); }
public void Given_I_Call_GetFieldValue_Then_The_Correct_Services_Are_Called(FieldNameType fieldNameType) { //arrange var dataValueMock = new Mock <IDataValue>(); var fieldMock = new Mock <IField>(); fieldMock.Setup(f => f.DataValue).Returns(dataValueMock.Object); _fieldServiceMock.Setup(f => f.GetField(_dataRecordMock.Object, fieldNameType)).Returns(fieldMock.Object); //act _sut.GetFieldValue(_dataRecordMock.Object, fieldNameType); //assert _fieldServiceMock.Verify(v => v.GetField(_dataRecordMock.Object, fieldNameType), Times.Once); }
public void Given_I_Call_FieldExists_Then_The_Correct_Services_Are_Called(FieldNameType fieldNameType) { //arrange var dataModelMock = new Mock <IDatamodel>(); dataModelMock.As <IDefinitionScope2>(); dataModelMock.As <IDefinitionScope2>().Setup(d => d.FieldExists(fieldNameType.ToString())).Returns(It.IsAny <bool>()); _dataModelServiceMock.Setup(d => d.GetDataModel(_connectionModel, It.IsAny <string>(), It.IsAny <string>())) .Returns(dataModelMock.Object); //act _sut.FieldExists(_connectionModel, _instrumentName, _serverParkName, fieldNameType); //assert _dataModelServiceMock.Verify(d => d.GetDataModel(_connectionModel, _instrumentName, _serverParkName), Times.Once); }
internal static Type GetFieldType(string fieldName, out FieldNameType fieldNameType) { if (fieldName.StartsWith(FieldNameCustomDimensionsPrefix, StringComparison.Ordinal)) { fieldNameType = FieldNameType.CustomDimensionName; return(typeof(string)); } if (fieldName.StartsWith(FieldNameCustomMetricsPrefix, StringComparison.Ordinal)) { fieldNameType = FieldNameType.CustomMetricName; return(typeof(double)); } if (fieldName.StartsWith(FieldNameAsterisk, StringComparison.Ordinal)) { fieldNameType = FieldNameType.AnyField; return(null); } // no special case in filterInfo.FieldName, treat it as the name of a property in TTelemetry type fieldNameType = FieldNameType.FieldName; return(GetPropertyTypeFromFieldName(fieldName)); }
public void Given_Valid_Arguments_When_I_Call_FieldExists_Then_The_Correct_Services_Are_Called(FieldNameType fieldNameType) { //act _sut.FieldExists(_connectionModel, _instrumentName, _serverParkName, fieldNameType); //assert _fieldServiceMock.Verify(v => v.FieldExists(_connectionModel, _instrumentName, _serverParkName, fieldNameType), Times.Once); }
public IField GetField(IDataRecord dataRecord, FieldNameType fieldNameType) { return(dataRecord.GetField(fieldNameType.FullName())); }
public bool FieldExists(IDataRecord dataRecord, FieldNameType fieldNameType) { var dataRecord2 = (IDataRecord2)dataRecord; return(dataRecord2.Fields.Any(f => f.FullName == fieldNameType.FullName())); }
public bool FieldExists(ConnectionModel connectionModel, string instrumentName, string serverParkName, FieldNameType fieldNameType) { var dataModel = _dataModelService.GetDataModel(connectionModel, instrumentName, serverParkName); var definitionScope = (IDefinitionScope2)dataModel; return(definitionScope.FieldExists(fieldNameType.FullName())); }
public IDataValue GetFieldValue(IDataRecord dataRecord, FieldNameType fieldNameType) { return(_fieldService.GetField(dataRecord, fieldNameType).DataValue); }
public void Given_A_DataRecord_When_I_Call_FieldExists_Then_The_Correct_Value_Is_Returned(FieldNameType fieldNameType, bool fieldExists) { //arrange var dataRecord2Mock = new Mock <IDataRecord2>(); var fieldCollectionMock = new Mock <IFieldCollection>(); var iFieldMock = new Mock <IField>(); if (fieldExists) { iFieldMock.Setup(f => f.FullName).Returns(fieldNameType.FullName()); } else { iFieldMock.Setup(f => f.FullName).Returns("Does Not Exist"); } var fields = new List <IField> { iFieldMock.Object }; fieldCollectionMock.Setup(f => f.GetEnumerator()) .Returns(fields.GetEnumerator()); dataRecord2Mock.Setup(d => d.Fields).Returns(fieldCollectionMock.Object); //act var result = _sut.FieldExists(dataRecord2Mock.Object, fieldNameType); //assert Assert.NotNull(result); Assert.AreEqual(fieldExists, result); }
public IDataValue GetFieldValue(IDataRecord dataRecord, FieldNameType fieldNameType) { throw new NotImplementedException(); }
public bool FieldExists(string instrumentName, string serverParkName, FieldNameType fieldNameType) { throw new NotImplementedException(); }
public bool FieldExists(ConnectionModel connectionModel, string instrumentName, string serverParkName, FieldNameType fieldNameType) { return(_fieldService.FieldExists(connectionModel, instrumentName, serverParkName, fieldNameType)); }
public IDataValue GetFieldValue(IDataRecord dataRecord, FieldNameType fieldNameType) { dataRecord.ThrowExceptionIfNull("dataRecord"); return(_caseService.GetFieldValue(dataRecord, fieldNameType)); }
public bool FieldExists(IDataRecord dataRecord, FieldNameType fieldNameType) { dataRecord.ThrowExceptionIfNull("dataRecord"); return(_caseService.FieldExists(dataRecord, fieldNameType)); }
public void Given_I_Call_GetFieldValue_Then_The_Correct_DataModel_Is_Returned(FieldNameType fieldNameType) { //arrange var dataValueMock = new Mock <IDataValue>(); var fieldMock = new Mock <IField>(); fieldMock.Setup(f => f.DataValue).Returns(dataValueMock.Object); _fieldServiceMock.Setup(f => f.GetField(_dataRecordMock.Object, fieldNameType)).Returns(fieldMock.Object); //act var result = _sut.GetFieldValue(_dataRecordMock.Object, fieldNameType); //assert Assert.AreEqual(dataValueMock.Object, result); }
public IDataValue GetFieldValue(string primaryKeyValue, string instrumentName, string serverParkName, FieldNameType fieldNameType) { throw new NotImplementedException(); }
internal static Expression ProduceFieldExpression(ParameterExpression documentExpression, string fieldName, FieldNameType fieldNameType) { switch (fieldNameType) { case FieldNameType.FieldName: return(fieldName.Split(FieldNameTrainSeparator).Aggregate <string, Expression>(documentExpression, Expression.Property)); case FieldNameType.CustomMetricName: string customMetricName = fieldName.Substring( FieldNameCustomMetricsPrefix.Length, fieldName.Length - FieldNameCustomMetricsPrefix.Length); return(CreateDictionaryAccessExpression( documentExpression, CustomMetricsPropertyName, DictionaryStringDoubleTryGetValueMethodInfo, typeof(double), customMetricName)); case FieldNameType.CustomDimensionName: string customDimensionName = fieldName.Substring( FieldNameCustomDimensionsPrefix.Length, fieldName.Length - FieldNameCustomDimensionsPrefix.Length); return(CreateDictionaryAccessExpression( documentExpression, CustomDimensionsPropertyName, DictionaryStringStringTryGetValueMethodInfo, typeof(string), customDimensionName)); default: throw new ArgumentOutOfRangeException(nameof(fieldNameType), fieldNameType, null); } }
public bool FieldExists(IDataRecord dataRecord, FieldNameType fieldNameType) { throw new NotImplementedException(); }
public bool FieldExists(IDataRecord dataRecord, FieldNameType fieldNameType) { return(_fieldService.FieldExists(dataRecord, fieldNameType)); }