public void NegativeConversionTest() { string NegativeTernaryValue = string.Format("-{0}", TernaryValue); string NegativeQuinaryValue = string.Format("-{0}", QuinaryValue); string NegativeSenaryValue = string.Format("-{0}", SenaryValue); string NegativeOctalValue = string.Format("-{0}", OctalValue); string NegativeUndecimalValue = string.Format("-{0}", UndecimalValue); string NegativePentadecimalValue = string.Format("-{0}", PentadecimalValue); Assert.AreEqual(NegativeTernaryValue, Excercise_1_1.ConvertBase(NegativePentadecimalValue, Excercise_1_1.BaseSystem.Pentadecimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(NegativeQuinaryValue, Excercise_1_1.ConvertBase(NegativeSenaryValue, Excercise_1_1.BaseSystem.Senary, Excercise_1_1.BaseSystem.Quinary)); Assert.AreEqual(NegativeTernaryValue, Excercise_1_1.ConvertBase(NegativeOctalValue, Excercise_1_1.BaseSystem.Octal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(NegativeOctalValue, Excercise_1_1.ConvertBase(NegativeUndecimalValue, Excercise_1_1.BaseSystem.Undecimal, Excercise_1_1.BaseSystem.Octal)); Assert.AreEqual(NegativeTernaryValue, Excercise_1_1.ConvertBase(NegativeUndecimalValue, Excercise_1_1.BaseSystem.Undecimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(NegativePentadecimalValue, Excercise_1_1.ConvertBase(NegativeOctalValue, Excercise_1_1.BaseSystem.Octal, Excercise_1_1.BaseSystem.Pentadecimal)); }
public void TernaryConversionTest() { Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(BinaryValue, Excercise_1_1.BaseSystem.Binary, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(QuaternaryValue, Excercise_1_1.BaseSystem.Quaternary, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(QuinaryValue, Excercise_1_1.BaseSystem.Quinary, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(SenaryValue, Excercise_1_1.BaseSystem.Senary, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(SeptenaryValue, Excercise_1_1.BaseSystem.Septenary, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(OctalValue, Excercise_1_1.BaseSystem.Octal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(NonaryValue, Excercise_1_1.BaseSystem.Nonary, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(DecimalValue, Excercise_1_1.BaseSystem.Decimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(UndecimalValue, Excercise_1_1.BaseSystem.Undecimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(DuodecimalValue, Excercise_1_1.BaseSystem.Duodecimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(TridecimalValue, Excercise_1_1.BaseSystem.Tridecimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(TetradecimalValue, Excercise_1_1.BaseSystem.Tetradecimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(PentadecimalValue, Excercise_1_1.BaseSystem.Pentadecimal, Excercise_1_1.BaseSystem.Ternary)); Assert.AreEqual(TernaryValue, Excercise_1_1.ConvertBase(HexadecimalValue, Excercise_1_1.BaseSystem.Hexadecimal, Excercise_1_1.BaseSystem.Ternary)); }
static void Main(string[] args) { Excercise_1_1.ConvertBase(2147483647.ToString(), Excercise_1_1.BaseSystem.Decimal, Excercise_1_1.BaseSystem.Binary); }