public async Task WhenPropertyIsAnIEvaluatedProperty_GetUnevaluatedValueAsyncIsCalled() { var properties = PropertiesAvailableStatusFactory.CreateUIPropertyValuePropertiesAvailableStatus( includeEvaluatedValue: false, includeUnevaluatedValue: true); var mockEvaluatedProperty = new Mock <IEvaluatedProperty>(); mockEvaluatedProperty.Setup(m => m.GetUnevaluatedValueAsync()).ReturnsAsync("unevaluated value"); var property = mockEvaluatedProperty.Object; var entityRuntime = IEntityRuntimeModelFactory.Create(); var id = new EntityIdentity(key: "A", value: "B"); var configuration = ProjectConfigurationFactory.Create(configuration: "Alpha|Beta|Gamma"); var result = (UIPropertyValueValue)await UIPropertyValueDataProducer.CreateUIPropertyValueValueAsync( entityRuntime, id, configuration, property, properties); Assert.Equal(expected: "unevaluated value", actual: result.UnevaluatedValue); mockEvaluatedProperty.Verify(m => m.GetUnevaluatedValueAsync()); }
public async Task WhenThePropertyIsAnIIntProperty_ThenTheEvaluatedValueIsAnInt() { var properties = PropertiesAvailableStatusFactory.CreateUIPropertyValuePropertiesAvailableStatus(includeEvaluatedValue: true); var mockIntProperty = new Mock <IIntProperty>(); mockIntProperty.Setup(m => m.GetValueAsIntAsync()).ReturnsAsync(42); var property = mockIntProperty.Object; var entityRuntime = IEntityRuntimeModelFactory.Create(); var id = new EntityIdentity(key: "A", value: "B"); var configuration = ProjectConfigurationFactory.Create(configuration: "Alpha|Beta|Gamma"); var result = (UIPropertyValueValue)await UIPropertyValueDataProducer.CreateUIPropertyValueValueAsync( entityRuntime, id, configuration, property, properties); Assert.Equal(expected: 42, actual: result.EvaluatedValue); }