public void GivenANullableDoublePropertyWithNullValue_WhenAccessedWithCompilerGeneratedPropertyGetter_ShouldReturnTheUnderlyingValue() { TypedPageActivator activator = new TypedPageActivator(); TestPageType page = (TestPageType)activator.CreateAndPopulateTypedInstance(new PageData(), typeof(TestPageType)); var property = new PropertyFloatNumber(); page.Property.Add("NullableDoubleTestProperty", property); double?returnedPropertyValue = page.NullableDoubleTestProperty; Assert.False(returnedPropertyValue.HasValue); }
public void GivenANullableDoubleProperty_WhenSetAndAccessedWithCompilerGeneratedPropertyGetter_ShouldReturnTheSetValue() { TypedPageActivator activator = new TypedPageActivator(); var originalPage = new PageData(); var property = new PropertyFloatNumber(); originalPage.Property.Add("NullableDoubleTestProperty", property); TestPageType page = (TestPageType)activator.CreateAndPopulateTypedInstance(originalPage, typeof(TestPageType)); double propertyValue = 123.45; page.NullableDoubleTestProperty = propertyValue; double returnedPropertyValue = page.NullableDoubleTestProperty.Value; Assert.Equal <double>(propertyValue, returnedPropertyValue); }