public void GivenPageFromCreateAndPopulateTypedInstance_CompilerGeneratedPropertyGetter_IsAutoImplemented() { TypedPageActivator activator = new TypedPageActivator(); TestPageType page = (TestPageType)activator.CreateAndPopulateTypedInstance(new PageData(), typeof(TestPageType)); page.Property.Add("CompilerGeneratedProperty", new PropertyString()); string propertyValue = TestValueUtility.CreateRandomString(); page.SetValue("CompilerGeneratedProperty", propertyValue); string returnedPropertyValue = page.CompilerGeneratedProperty; Assert.Equal <string>(propertyValue, returnedPropertyValue); }
public void GivenANullableIntProperty_WhenAccessedWithCompilerGeneratedPropertyGetter_ShouldReturnTheUnderlyingValue() { TypedPageActivator activator = new TypedPageActivator(); TestPageType page = (TestPageType)activator.CreateAndPopulateTypedInstance(new PageData(), typeof(TestPageType)); var property = new PropertyNumber(); page.Property.Add("NullableIntTestProperty", property); int propertyValue = 123; page.SetValue("NullableIntTestProperty", propertyValue); int returnedPropertyValue = page.NullableIntTestProperty.Value; Assert.Equal <int>(propertyValue, returnedPropertyValue); }