public void IncomingCascadingValueMatchesCascadingParameter_SetsValue() { // Arrange var builder = new ParameterViewBuilder(); builder.Add(nameof(HasCascadingParameter.Cascading), "hi", cascading: true); var parameters = builder.Build(); var target = new HasCascadingParameter(); // Act parameters.SetParameterProperties(target); // Assert Assert.Equal("hi", target.Cascading); }
public void NoIncomingCascadingValueMatchesDeclaredCascadingParameter_LeavesValueUnchanged() { // Arrange var builder = new ParameterViewBuilder(); var parameters = builder.Build(); var target = new HasCascadingParameter() { Cascading = "bye", }; // Act parameters.SetParameterProperties(target); // Assert Assert.Equal("bye", target.Cascading); }
public void IncomingCascadingValueMatchesNoDeclaredParameter_Throws() { // Arrange var builder = new ParameterViewBuilder(); builder.Add("SomethingElse", "hi", cascading: true); var parameters = builder.Build(); var target = new HasCascadingParameter(); // Act var ex = Assert.Throws <InvalidOperationException>(() => parameters.SetParameterProperties(target)); // Assert Assert.Equal( $"Object of type '{typeof(HasCascadingParameter).FullName}' does not have a property " + $"matching the name 'SomethingElse'.", ex.Message); }