public static void Main() { Console.WriteLine("Enter to float numbers to convert it to binary and add them\n"); //creation of objects to have acess to all methods and variables of class ConvertToBinary firstNumber = new ConvertToBinary(); ConvertToBinary secondNumber = new ConvertToBinary(); BinaryAddition additionResult = new BinaryAddition(); Console.Write("\nResult in Binary : "); //add the number and Displays the result additionResult.DisplayResult(additionResult.AddBinaryNumbers(firstNumber.m_FloatBinary, secondNumber.m_FloatBinary)); Console.Write("\nResult in Float : " + additionResult.ConvertBinaryToFloat(additionResult.m_Result)); Console.ReadLine(); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } BinaryAddition = await _context.BinaryAddition.FirstOrDefaultAsync(m => m.ID == id); if (BinaryAddition == null) { return(NotFound()); } return(Page()); }
public void Random() { var rnd = new Random(); for (int i = 0; i < 100; ++i) { int a = rnd.Next(0, 100000); int b = rnd.Next(0, 100000); string expected = Convert.ToString(a + b, 2); Assert.AreEqual(expected, BinaryAddition.AddBinary(a, b), $"Should return \"{expected}\" for {a} + {b}"); } ; }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } BinaryAddition = await _context.BinaryAddition.FindAsync(id); if (BinaryAddition != null) { _context.BinaryAddition.Remove(BinaryAddition); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public void TestExample() { Assert.AreEqual("11", BinaryAddition.AddBinary(1, 2), "Should return \"11\" for 1 + 2"); }
public void AddBinaryTests() { Assert.Equal("11", BinaryAddition.AddBinary(1, 2)); }
public void Test_Hundred_Zero() { Assert.AreEqual("1100100", BinaryAddition.AddBinary(100, 0), "Should return \"1100100\" for 100 + 0"); }
public void Test_FiftyOne_Twelve() { Assert.AreEqual("111111", BinaryAddition.AddBinary(51, 12), "Should return \"111111\" for 51 + 12"); }
public void TestBinaryAddition() { var actual = BinaryAddition.ComputeBinarySum(1, 2); Assert.Equal("11", actual); }