public void PropertySetter_SetTimeSpan(float seconds) { var applicationOptions = OptionsMocks.CreateApplicationOptions(); var propertySetter = new PropertySetter(applicationOptions); var component = ComponentMocks.CreateComponent <BasicTemplatelessComponent>(); component.Name = "TestComponent"; var propertyValue = new TimeSpanPropertyValue(seconds); propertySetter.SetValue(component, nameof(BasicTemplatelessComponent.TimeSpan), propertyValue); Assert.Equal(TimeSpan.FromSeconds(seconds), component.TimeSpan); }
public void PropertySetter_SetScalar(float value) { var applicationOptions = OptionsMocks.CreateApplicationOptions(); var propertySetter = new PropertySetter(applicationOptions); var component = ComponentMocks.CreateComponent <BasicTemplatelessComponent>(); component.Name = "TestComponent"; var propertyValue = new ScalarPropertyValue(value); propertySetter.SetValue(component, nameof(BasicTemplatelessComponent.Length), propertyValue); Assert.Equal(value, component.Single); }
public void PropertySetter_SetLength(string unit, float length) { var applicationOptions = OptionsMocks.CreateApplicationOptions(); var propertySetter = new PropertySetter(applicationOptions); var component = ComponentMocks.CreateComponent <BasicTemplatelessComponent>(); component.Name = "TestComponent"; var propertyValue = new LengthPropertyValue(unit, length); propertySetter.SetValue(component, nameof(BasicTemplatelessComponent.Length), propertyValue); Assert.Equal(unit == "%", component.Length[UnitType.Percentage] != 0); Assert.Equal(unit == "px", component.Length[UnitType.Pixel] != 0); Assert.Equal(unit == "x", component.Length[UnitType.Ratio] != 0); Assert.Equal(unit == "u", component.Length[UnitType.Unit] != 0); }