<commit_before>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Assert.cs" company="">
//   Copyright 2013 <NAME>
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//       http://www.apache.org/licenses/LICENSE-2.0
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace NFluent
{
    using System.Collections;
    using System.Collections.Generic;
    using System.Reflection;

    /// <summary>
    /// Contains a collection of static methods that implement the only assertions you need to be fluent (if your favorite .NET unit test framework doesn't provide it).
    /// If you are using NUnit, this <see cref="T:NFluent.Assert"/> class is useless (since NUnit provides now few Assert.That() overloads).
    /// On the other hand, xUnit users may benefit to this class.
    /// </summary>
    public static class Assert
    {
        /// <summary>
        /// Asserts that a condition is true. If the condition is false the method throw a <see cref="T:FluentAssertionException"/>.
        /// </summary>
        /// <param name="condition">The evaluated condition.</param>
        public static void That(bool condition)
        {
            // TODO: improve the default message of failing Assert.That
            That(condition, string.Empty);
        }

        /// <summary>
        /// Asserts that a condition is true. If the condition is false the method throw a <see cref="T:FluentAssertionException" />.
        /// </summary>
        /// <param name="condition">The evaluated condition.</param>
        /// <param name="message">The message for the <see cref="FluentAssertionException"/> if assertion fails.</param>
        /// <exception cref="FluentAssertionException">The assertion fails.</exception>
        public static void That(bool condition, string message)
        {
            if (!condition)
            {
                throw new FluentAssertionException(message);
            }
        }

        public static IFluentEnumerable That(IEnumerable enumerable)
        {
            return new FluentEnumerable(enumerable);
        }

        //public static IFluentEnumerable<T> That<T>(IEnumerable<T> enumerable)
        //{
        //    return new FluentEnumerable<T>(enumerable);
        //}

        public static IFluentString That(string value)
        {
            return new FluentString(value);
        }
    }
}
<commit_msg>Refactors and cleans the Assert static class (including documentation).<commit_after>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Assert.cs" company="">
//   Copyright 2013 <NAME>
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//       http://www.apache.org/licenses/LICENSE-2.0
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace NFluent
{
    using System.Collections;

    /// <summary>
    /// Provides a set of static methods that return fluent objects to be used then to assert things on a System Under Test (SUT) instance. 
    /// </summary>
    public static class Assert
    {
        /// <summary>
        /// Returns a <see cref="IFluentEnumerable"/> instance that will provide assertion methods to be executed on the System Under Test enumerable instance.
        /// </summary>
        /// <remarks>
        ///     Methods of the returned <see cref="IFluentEnumerable"/> instance will usually throw a <see cref="T:FluentAssertionException"/> when failing.
        /// </remarks>
        /// <param name="enumerable">The System Under Test enumerable instance.</param>
        /// <returns>A <see cref="IFluentEnumerable"/> instance to use in order to assert things on the System Under Test enumerable instance.</returns>
        public static IFluentEnumerable That(IEnumerable enumerable)
        {
            return new FluentEnumerable(enumerable);
        }

        /// <summary>
        /// Returns a <see cref="IFluentString"/> instance that will provide assertion methods to be executed on the System Under Test string instance.
        /// </summary>
        /// <remarks>
        ///     Methods of the returned <see cref="IFluentString"/> instance will usually throw a <see cref="T:FluentAssertionException"/> when failing.
        /// </remarks>
        /// <param name="value">The System Under Test string instance.</param>
        /// <returns>A <see cref="IFluentString"/> instance to use in order to assert things on the System Under Test string instance.</returns>
        public static IFluentString That(string value)
        {
            return new FluentString(value);
        }
    }
}

{'fraction_non_alphanumeric': 0.17466344494304453, 'fraction_numerical': 0.002761477390403866, 'mean_word_length': 1.903306613226453, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4072139', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1295, 'n_words': 538}