<commit_before>﻿using NUnit.Framework;

namespace UnitsNet.Tests.net35
{
    [TestFixture]
    public class ForceTests
    {
        private const double Delta = 1E-5;

        [Test]
        public void NewtonToForceUnits()
        { 
            Force oneNewton = Force.FromNewtons(1);

            Assert.AreEqual(1E-3, oneNewton.Kilonewtons);
            Assert.AreEqual(1, oneNewton.Newtons);
            Assert.AreEqual(1E5, oneNewton.Dyne);
            Assert.AreEqual(0.10197, oneNewton.KilogramForce, Delta);
            Assert.AreEqual(0.10197, oneNewton.KiloPonds, Delta);
            Assert.AreEqual(0.22481, oneNewton.PoundForce, Delta);
            Assert.AreEqual(7.2330, oneNewton.Poundal, Delta);
        }

        [Test]
        public void ForceUnitsRoundTrip()
        {
            Force oneNewton = Force.FromNewtons(1);

            Assert.AreEqual(1, Force.FromNewtons(oneNewton.Newtons).Newtons, Delta);
            Assert.AreEqual(1, Force.FromKilonewtons(oneNewton.Kilonewtons).Newtons, Delta);
            Assert.AreEqual(1, Force.FromKilogramForce(oneNewton.KilogramForce).Newtons, Delta);
            Assert.AreEqual(1, Force.FromDyne(oneNewton.Dyne).Newtons, Delta);
            Assert.AreEqual(1, Force.FromKiloPonds(oneNewton.KiloPonds).Newtons, Delta);
            Assert.AreEqual(1, Force.FromPoundForce(oneNewton.PoundForce).Newtons, Delta);
            Assert.AreEqual(1, Force.FromPoundal(oneNewton.Poundal).Newtons, Delta);
        }
    }
}<commit_msg>Added unit tests in ForceTests.cs: * ArithmeticOperators * ComparisonAndEqualityOperators * CompareToIsImplemented * CompareToThrowsOnTypeMismatch * CompareToThrowsOnNull * EqualsIsImplemented * EqualsReturnsFalseOnTypeMismatch * EqualsReturnsFalseOnNull<commit_after>﻿using System;
using NUnit.Framework;

namespace UnitsNet.Tests.net35
{
    [TestFixture]
    public class ForceTests
    {
        private const double Delta = 1E-5;

        [Test]
        public void NewtonToForceUnits()
        { 
            Force newton = Force.FromNewtons(1);
            Assert.AreEqual(1E-3, newton.Kilonewtons);
            Assert.AreEqual(1, newton.Newtons);
            Assert.AreEqual(1E5, newton.Dyne);
            Assert.AreEqual(0.10197, newton.KilogramForce, Delta);
            Assert.AreEqual(0.10197, newton.KiloPonds, Delta);
            Assert.AreEqual(0.22481, newton.PoundForce, Delta);
            Assert.AreEqual(7.2330, newton.Poundal, Delta);
        }

        [Test]
        public void ForceUnitsRoundTrip()
        {
            Force newton = Force.FromNewtons(1);
            Assert.AreEqual(1, Force.FromNewtons(newton.Newtons).Newtons, Delta);
            Assert.AreEqual(1, Force.FromKilonewtons(newton.Kilonewtons).Newtons, Delta);
            Assert.AreEqual(1, Force.FromKilogramForce(newton.KilogramForce).Newtons, Delta);
            Assert.AreEqual(1, Force.FromDyne(newton.Dyne).Newtons, Delta);
            Assert.AreEqual(1, Force.FromKiloPonds(newton.KiloPonds).Newtons, Delta);
            Assert.AreEqual(1, Force.FromPoundForce(newton.PoundForce).Newtons, Delta);
            Assert.AreEqual(1, Force.FromPoundal(newton.Poundal).Newtons, Delta);
        }

        [Test]
        public void ArithmeticOperators()
        {
            Force newton = Force.FromNewtons(1);
            Assert.AreEqual(-1, -newton.Newtons, Delta);
            Assert.AreEqual(2, (newton + newton).Newtons, Delta);
            Assert.AreEqual(1, (Force.FromNewtons(2) - newton).Newtons, Delta);
            Assert.AreEqual(10, (newton*10).Newtons, Delta);
            Assert.AreEqual(10, (10*newton).Newtons, Delta);
            Assert.AreEqual(2, (Force.FromNewtons(10)/5).Newtons, Delta);
        }

        [Test]
        public void ComparisonAndEqualityOperators()
        {
            Force oneNewton = Force.FromNewtons(1);
            Force twoNewtons = Force.FromNewtons(2);

            Assert.True(oneNewton < twoNewtons);
            Assert.True(oneNewton <= twoNewtons);
            Assert.True(twoNewtons > oneNewton);
            Assert.True(twoNewtons >= oneNewton);
            Assert.True(oneNewton == oneNewton);
            Assert.True(oneNewton != twoNewtons);
        }

        [Test]
        public void CompareToIsImplemented()
        {
            Force newton = Force.FromNewtons(1);
            Assert.AreEqual(0, newton.CompareTo(newton));
            Assert.Greater(newton.CompareTo(Force.Zero), 0);
            Assert.Less(Force.Zero.CompareTo(newton), 0);
        }

        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void CompareToThrowsOnTypeMismatch()
        {
            Force newton = Force.FromNewtons(1);
            newton.CompareTo(new object());
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void CompareToThrowsOnNull()
        { 
            Force newton = Force.FromNewtons(1);
            newton.CompareTo(null);
        }

        [Test]
        public void EqualsIsImplemented()
        {
            Force newton = Force.FromNewtons(1);
            Assert.IsTrue(newton.Equals(Force.FromNewtons(1)));
            Assert.IsFalse(newton.Equals(Force.Zero));
        }

        [Test]
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            Force newton = Force.FromNewtons(1);
            Assert.IsFalse(newton.Equals(new object()));
        }

        [Test]
        public void EqualsReturnsFalseOnNull()
        {
            Force newton = Force.FromNewtons(1);
            Assert.IsFalse(newton.Equals(null));
        }
    }
}
{'fraction_non_alphanumeric': 0.1105159792894126, 'fraction_numerical': 0.01981788966256026, 'mean_word_length': 2.320687611144043, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6300648', 'n_tokens_mistral': 1779, 'n_tokens_neox': 1687, 'n_words': 253}