/// <summary>
        /// Creates and returns a new validation context.
        /// </summary>
        /// <param name="instance">The object to create the context for.</param>
        /// <param name="items">The dictionary of key/value pairs that is associated with this context.</param>
        /// <returns>A new validation context.</returns>
        public virtual IValidationContext CreateContext( object instance, IDictionary<object, object> items )
        {
            Arg.NotNull( instance, nameof( instance ) );

            var context = new ValidationContext( instance, items );
            context.InitializeServiceProvider( ServiceProvider.Current.GetService );
            return new ValidationContextAdapter( context );
        }
        public void GetServiceShouldCallUnderlyingServiceProvider()
        {
            // arrange
            var instance = new object();
            var serviceProvider = new Mock<IServiceProvider>();

            serviceProvider.Setup( sp => sp.GetService( It.IsAny<Type>() ) ).Returns( null );

            var context = new ValidationContext( instance, serviceProvider.Object, null );

            // act
            var actual = context.GetService( typeof( object ) );

            // assert
            Assert.Null( actual );
            serviceProvider.Verify( sp => sp.GetService( typeof( object ) ), Times.Once() );
        }