public void Percentage_changes_property_of_parent_correctly( Type ViewType, string targetProperty, double percentage, double expectedValue, double startAt, double endAt, double from, double to, Easing easing) { //Arrange var propertyType = new BindablePropertyConverter() .ConvertFromInvariantString(targetProperty) as BindableProperty; var control = Activator.CreateInstance(ViewType) as View; var sut = new TestScaleToBehavior { TargetProperty = propertyType, Percentage = 0, StartAt = startAt, EndAt = endAt, From = from, To = to, Easing = easing }; control.Behaviors.Add(sut); //Act sut.Percentage = percentage; //Assert var propertyValue = (double)control.GetValue(propertyType); propertyValue.Should().Be(expectedValue); }
public void Percentage_should_replace_by_set_correctly( double value, double expectedValue, bool throwException) { //Arrange var sut = new TestScaleToBehavior(); var throwed = false; //Act try { sut.Percentage = value; }catch (ArgumentException e) { throwed = true; } //Assert throwed.Should().Be(throwException); sut.Percentage.Should().Be(expectedValue); }