//******************************************************************************************************// ChargeTest.cs - Gbtc//// Copyright © 2012, Grid Protection Alliance. All Rights Reserved.//// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See// the NOTICE file distributed with this work for additional information regarding copyright ownership.// The GPA licenses this file to you under the MIT License (MIT), 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.opensource.org/licenses/MIT//// Unless agreed to in writing, the subject software distributed under the License is distributed on an// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the// License for the specific language governing permissions and limitations.//// Code Modification History:// ----------------------------------------------------------------------------------------------------// 02/01/2011 - Denis Kholine// 12/13/2012 - Starlynn Danyelle Gilliam// Modified Header.////****************************************************************************************************** #region [ University of Illinois/NCSA Open Source License ]/*Copyright © <2012> <University of Illinois>All rights reserved. Developed by: <ITI><University of Illinois><http://www.iti.illinois.edu/>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution.• Neither the names of <Name of Development Group, Name of Institution>, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.*/#endregion using System;using System.Collections.Generic;using System.Globalization;using GSF.Units;using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GSF.Core.Tests{ /// <summary> ///This is a test class for ChargeTest and is intended ///to contain all ChargeTest Unit Tests ///</summary> [TestClass] public class ChargeTest { private TestContext testContextInstance; /// <summary> ///Gets or sets the test context which provides ///information about and functionality for the current test run. ///</summary> public TestContext TestContext { get { return testContextInstance; } set { testContextInstance = value; } } #region Additional test attributes // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion /// <summary> ///A test for Charge Constructor ///</summary> [TestMethod] public void ChargeConstructorTest() { List<Double> values = new List<Double>(); //Initialization values.Add(0); foreach (Double value in values) { Charge target = new Charge(value); Assert.IsInstanceOfType(target, typeof(Charge)); Assert.IsNotNull(target); } values.Clear(); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="double"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="double"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToDoubleEqualTest() { //equal Charge target = new Charge(10F); double value = 10F; int expected = 0; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="double"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="double"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToDoubleLessTest() { Charge target = new Charge(10F); double value = 9F; int expected = 1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="double"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="double"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToDoubleGreaterTest() { Charge target = new Charge(10F); double value = 11F; int expected = -1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="Charge"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="Charge"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToChargeEqualTest() { Charge target = new Charge(10F); Charge value = new Charge(10F); int expected = 0; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="Charge"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="Charge"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToChargeLessTest() { Charge target = new Charge(10F); Charge value = new Charge(9F); int expected = 1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="Charge"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="Charge"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToChargeGreaterTest() { Charge target = new Charge(10F); Charge value = new Charge(11F); int expected = -1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified object and returns an indication of their relative values. /// </summary> /// <param name="value">An object to compare, or null.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> /// <exception cref="ArgumentException">value is not a <see cref="Double"/> or <see cref="Charge"/>.</exception> [TestMethod] public void CompareToObjectEqualTest() { Charge target = new Charge(10F); object value = new Charge(10F); int expected = 0; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified object and returns an indication of their relative values. /// </summary> /// <param name="value">An object to compare, or null.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> /// <exception cref="ArgumentException">value is not a <see cref="Double"/> or <see cref="Charge"/>.</exception> [TestMethod] public void CompareToObjectLessTest() { Charge target = new Charge(10F); object value = new Charge(9F); int expected = 1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified object and returns an indication of their relative values. /// </summary> /// <param name="value">An object to compare, or null.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> /// <exception cref="ArgumentException">value is not a <see cref="Double"/> or <see cref="Charge"/>.</exception> [TestMethod] public void CompareToObjectGreaterTest() { Charge target = new Charge(10F); object value = new Charge(11F); int expected = -1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for Equals /// Returns a value indicating whether this instance is equal to a specified object. /// </summary> /// <param name="obj">An object to compare, or null.</param> /// <returns> /// True if obj is an instance of <see cref="Double"/> or <see cref="Charge"/> and equals the value of this instance; /// otherwise, False. /// </returns> [TestMethod] public void EqualsObjectTest() { Charge target = new Charge(10F); object obj = 11F; bool expected = false; bool actual = target.Equals(obj); Assert.AreEqual(expected, actual); } /// <summary> /// A test for Equals /// Returns a value indicating whether this instance is equal to a specified <see cref="Charge"/> value. /// </summary> /// <param name="obj">A <see cref="Charge"/> value to compare to this instance.</param> /// <returns> /// True if obj has the same value as this instance; otherwise, False. /// </returns> [TestMethod] public void EqualsChargeTest() { Charge target = new Charge(10F); Charge obj = new Charge(9F); bool expected = false; bool actual; actual = target.Equals(obj); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); } /// <summary> /// A test for Equals /// Returns a value indicating whether this instance is equal to a specified <see cref="Double"/> value. /// </summary> /// <param name="obj">A <see cref="Double"/> value to compare to this instance.</param> /// <returns> /// True if obj has the same value as this instance; otherwise, False. /// </returns> [TestMethod] public void EqualsDoubleTest() { Charge target = new Charge(10F); double obj = 9F; bool expected = false; bool actual; actual = target.Equals(obj); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); } ///// <summary> ///// A test for FromAbcoulombs ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in abcoulombs. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in abcoulombs.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in abcoulombs.</returns> //[TestMethod] //public void FromAbcoulombsTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromAbcoulombs(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromAmpereHours ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in ampere-hours. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in ampere-hours.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in ampere-hours.</returns> //[TestMethod] //public void FromAmpereHoursTest() //{ // double value = 10F; // Charge expected = new Charge(10); // Charge actual = Charge.FromAmpereHours(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromAtomicUnitsOfCharge ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in atomic units of charge. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in atomic units of charge.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in atomic units of charge.</returns> //[TestMethod] //public void FromAtomicUnitsOfChargeTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromAtomicUnitsOfCharge(value); // Assert.AreEqual(expected, actual); // ///Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromFaraday ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in faraday. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in faraday.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in faraday.</returns> //[TestMethod] //public void FromFaradayTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromFaraday(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromStatcoulombs ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in statcoulombs. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in statcoulombs.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in statcoulombs.</returns> //[TestMethod] //public void FromStatcoulombsTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromStatcoulombs(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for GetHashCode ///// Returns the hash code for this instance. ///// </summary> ///// <returns> ///// A 32-bit signed integer hash code. ///// </returns> //[TestMethod] //public void GetHashCodeTest() //{ // Charge target = new Charge(10F); // int expected = 10; // int actual = target.GetHashCode(); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} /// <summary> /// A test for GetTypeCode /// Returns the <see cref="TypeCode"/> for value type <see cref="Double"/>. /// </summary> /// <returns>The enumerated constant, <see cref="TypeCode.Double"/>.</returns> [TestMethod] public void GetTypeCodeTest() { Charge target = new Charge(10F); TypeCode expected = new TypeCode(); expected = TypeCode.Double; TypeCode actual = target.GetTypeCode(); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); } /// <summary>Lines 1–500 of 1263. Load more
//****************************************************************************************************** // ChargeTest.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), 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.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 02/01/2011 - Denis Kholine // 12/13/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** #region [ University of Illinois/NCSA Open Source License ] /* Copyright © <2012> <University of Illinois> All rights reserved. Developed by: <ITI> <University of Illinois> <http://www.iti.illinois.edu/> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. • Neither the names of <Name of Development Group, Name of Institution>, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. */ #endregion using System; using System.Collections.Generic; using System.Globalization; using GSF.Units; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GSF.Core.Tests { /// <summary> ///This is a test class for ChargeTest and is intended ///to contain all ChargeTest Unit Tests ///</summary> [TestClass] public class ChargeTest { private TestContext testContextInstance; /// <summary> ///Gets or sets the test context which provides ///information about and functionality for the current test run. ///</summary> public TestContext TestContext { get { return testContextInstance; } set { testContextInstance = value; } } #region Additional test attributes // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion /// <summary> ///A test for Charge Constructor ///</summary> [TestMethod] public void ChargeConstructorTest() { List<Double> values = new List<Double>(); //Initialization values.Add(0); foreach (Double value in values) { Charge target = new Charge(value); Assert.IsInstanceOfType(target, typeof(Charge)); Assert.IsNotNull(target); } values.Clear(); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="double"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="double"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToDoubleEqualTest() { //equal Charge target = new Charge(10F); double value = 10F; int expected = 0; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="double"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="double"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToDoubleLessTest() { Charge target = new Charge(10F); double value = 9F; int expected = 1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="double"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="double"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToDoubleGreaterTest() { Charge target = new Charge(10F); double value = 11F; int expected = -1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="Charge"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="Charge"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToChargeEqualTest() { Charge target = new Charge(10F); Charge value = new Charge(10F); int expected = 0; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="Charge"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="Charge"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToChargeLessTest() { Charge target = new Charge(10F); Charge value = new Charge(9F); int expected = 1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified <see cref="Charge"/> and returns an indication of their /// relative values. /// </summary> /// <param name="value">A <see cref="Charge"/> to compare.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> [TestMethod] public void CompareToChargeGreaterTest() { Charge target = new Charge(10F); Charge value = new Charge(11F); int expected = -1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified object and returns an indication of their relative values. /// </summary> /// <param name="value">An object to compare, or null.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> /// <exception cref="ArgumentException">value is not a <see cref="Double"/> or <see cref="Charge"/>.</exception> [TestMethod] public void CompareToObjectEqualTest() { Charge target = new Charge(10F); object value = new Charge(10F); int expected = 0; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified object and returns an indication of their relative values. /// </summary> /// <param name="value">An object to compare, or null.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> /// <exception cref="ArgumentException">value is not a <see cref="Double"/> or <see cref="Charge"/>.</exception> [TestMethod] public void CompareToObjectLessTest() { Charge target = new Charge(10F); object value = new Charge(9F); int expected = 1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for CompareTo /// Compares this instance to a specified object and returns an indication of their relative values. /// </summary> /// <param name="value">An object to compare, or null.</param> /// <returns> /// A signed number indicating the relative values of this instance and value. Returns less than zero /// if this instance is less than value, zero if this instance is equal to value, or greater than zero /// if this instance is greater than value. /// </returns> /// <exception cref="ArgumentException">value is not a <see cref="Double"/> or <see cref="Charge"/>.</exception> [TestMethod] public void CompareToObjectGreaterTest() { Charge target = new Charge(10F); object value = new Charge(11F); int expected = -1; int actual; actual = target.CompareTo(value); Assert.AreEqual(expected, actual); } /// <summary> /// A test for Equals /// Returns a value indicating whether this instance is equal to a specified object. /// </summary> /// <param name="obj">An object to compare, or null.</param> /// <returns> /// True if obj is an instance of <see cref="Double"/> or <see cref="Charge"/> and equals the value of this instance; /// otherwise, False. /// </returns> [TestMethod] public void EqualsObjectTest() { Charge target = new Charge(10F); object obj = 11F; bool expected = false; bool actual = target.Equals(obj); Assert.AreEqual(expected, actual); } /// <summary> /// A test for Equals /// Returns a value indicating whether this instance is equal to a specified <see cref="Charge"/> value. /// </summary> /// <param name="obj">A <see cref="Charge"/> value to compare to this instance.</param> /// <returns> /// True if obj has the same value as this instance; otherwise, False. /// </returns> [TestMethod] public void EqualsChargeTest() { Charge target = new Charge(10F); Charge obj = new Charge(9F); bool expected = false; bool actual; actual = target.Equals(obj); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); } /// <summary> /// A test for Equals /// Returns a value indicating whether this instance is equal to a specified <see cref="Double"/> value. /// </summary> /// <param name="obj">A <see cref="Double"/> value to compare to this instance.</param> /// <returns> /// True if obj has the same value as this instance; otherwise, False. /// </returns> [TestMethod] public void EqualsDoubleTest() { Charge target = new Charge(10F); double obj = 9F; bool expected = false; bool actual; actual = target.Equals(obj); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); } ///// <summary> ///// A test for FromAbcoulombs ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in abcoulombs. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in abcoulombs.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in abcoulombs.</returns> //[TestMethod] //public void FromAbcoulombsTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromAbcoulombs(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromAmpereHours ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in ampere-hours. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in ampere-hours.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in ampere-hours.</returns> //[TestMethod] //public void FromAmpereHoursTest() //{ // double value = 10F; // Charge expected = new Charge(10); // Charge actual = Charge.FromAmpereHours(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromAtomicUnitsOfCharge ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in atomic units of charge. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in atomic units of charge.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in atomic units of charge.</returns> //[TestMethod] //public void FromAtomicUnitsOfChargeTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromAtomicUnitsOfCharge(value); // Assert.AreEqual(expected, actual); // ///Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromFaraday ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in faraday. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in faraday.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in faraday.</returns> //[TestMethod] //public void FromFaradayTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromFaraday(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for FromStatcoulombs ///// Creates a new <see cref="Charge"/> value from the specified <paramref name="value"/> in statcoulombs. ///// </summary> ///// <param name="value">New <see cref="Charge"/> value in statcoulombs.</param> ///// <returns>New <see cref="Charge"/> object from the specified <paramref name="value"/> in statcoulombs.</returns> //[TestMethod] //public void FromStatcoulombsTest() //{ // double value = 10F; // Charge expected = new Charge(10F); // Charge actual = Charge.FromStatcoulombs(value); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} ///// <summary> ///// A test for GetHashCode ///// Returns the hash code for this instance. ///// </summary> ///// <returns> ///// A 32-bit signed integer hash code. ///// </returns> //[TestMethod] //public void GetHashCodeTest() //{ // Charge target = new Charge(10F); // int expected = 10; // int actual = target.GetHashCode(); // Assert.AreEqual(expected, actual); // //Assert.Inconclusive("Verify the correctness of this test method."); //} /// <summary> /// A test for GetTypeCode /// Returns the <see cref="TypeCode"/> for value type <see cref="Double"/>. /// </summary> /// <returns>The enumerated constant, <see cref="TypeCode.Double"/>.</returns> [TestMethod] public void GetTypeCodeTest() { Charge target = new Charge(10F); TypeCode expected = new TypeCode(); expected = TypeCode.Double; TypeCode actual = target.GetTypeCode(); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); } /// <summary>