/// <summary> /// Validates whether Properties are the same as the provided ones from action result containing such property by using a builder. /// </summary> /// <param name="authenticationPropertiesBuilder">Authentication properties builder.</param> /// <param name="testContext"><see cref="ControllerTestContext"/> containing data about the currently executed assertion chain.</param> public static void ValidateAuthenticationProperties( Action <IAuthenticationPropertiesTestBuilder> authenticationPropertiesBuilder, ControllerTestContext testContext) { var actionResult = testContext.MethodResultAs <dynamic>(); var actualAuthenticationProperties = (AuthenticationProperties)TryGetAuthenticationProperties(actionResult) ?? new AuthenticationProperties(); var newAuthenticationPropertiesTestBuilder = new AuthenticationPropertiesTestBuilder(testContext); authenticationPropertiesBuilder(newAuthenticationPropertiesTestBuilder); var expectedAuthenticationProperties = newAuthenticationPropertiesTestBuilder.GetAuthenticationProperties(); var validations = newAuthenticationPropertiesTestBuilder.GetAuthenticationPropertiesValidations(); validations.ForEach(v => v(expectedAuthenticationProperties, actualAuthenticationProperties)); }
/// <summary> /// Validates whether Properties are the same as the provided ones from action result containing such property by using a builder. /// </summary> /// <param name="authenticationPropertiesBuilder">Authentication properties builder.</param> /// <param name="testContext"><see cref="ControllerTestContext"/> containing data about the currently executed assertion chain.</param> public static void ValidateAuthenticationProperties( Action<IAuthenticationPropertiesTestBuilder> authenticationPropertiesBuilder, ControllerTestContext testContext) { var actionResult = testContext.ActionResultAs<dynamic>(); var actualAuthenticationProperties = (AuthenticationProperties)TryGetAuthenticationProperties(actionResult) ?? new AuthenticationProperties(); var newAuthenticationPropertiesTestBuilder = new AuthenticationPropertiesTestBuilder(testContext); authenticationPropertiesBuilder(newAuthenticationPropertiesTestBuilder); var expectedAuthenticationProperties = newAuthenticationPropertiesTestBuilder.GetAuthenticationProperties(); var validations = newAuthenticationPropertiesTestBuilder.GetAuthenticationPropertiesValidations(); validations.ForEach(v => v(expectedAuthenticationProperties, actualAuthenticationProperties)); }