PR1 Done
This commit is contained in:
187
USqlCSharpUdoUnitTestProject1/UnitTest1.cs
Normal file
187
USqlCSharpUdoUnitTestProject1/UnitTest1.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
using ConsoleApp1;
|
||||
using Microsoft.Analytics.Interfaces;
|
||||
using Microsoft.Analytics.Interfaces.Streaming;
|
||||
using Microsoft.Analytics.Types.Sql;
|
||||
using Microsoft.Analytics.UnitTest;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PR1;
|
||||
using System.Numerics;
|
||||
|
||||
namespace USqlCSharpUdoUnitTestProject1
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
Calculator Calculator1 = new Calculator();
|
||||
public UnitTest1()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
double x = 2;
|
||||
double y = 5;
|
||||
|
||||
double result1 = 7;
|
||||
double result2 = -3;
|
||||
double result3 = 10;
|
||||
double result4 = 0.4;
|
||||
|
||||
Assert.AreEqual(Calculator1.Addiction(x, y), result1);
|
||||
Assert.AreEqual(Calculator1.Subtraction(x, y), result2);
|
||||
Assert.AreEqual(Calculator1.Multipliction(x, y), result3);
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result4);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestMethod2()
|
||||
{
|
||||
double x = -2;
|
||||
double y = -5;
|
||||
|
||||
double result1 = -7;
|
||||
double result2 = 3;
|
||||
double result3 = 10;
|
||||
double result4 = 0.4;
|
||||
|
||||
Assert.AreEqual(Calculator1.Addiction(x, y), result1);
|
||||
Assert.AreEqual(Calculator1.Subtraction(x, y), result2);
|
||||
Assert.AreEqual(Calculator1.Multipliction(x, y), result3);
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result4);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestMethod3()
|
||||
{
|
||||
double x = 2.5;
|
||||
double y = 3.6;
|
||||
|
||||
double result1 = 6.1;
|
||||
double result2 = -1.1;
|
||||
double result3 = 9;
|
||||
double result4 = 0.69444444444444444444444444444444;
|
||||
|
||||
Assert.AreEqual(Calculator1.Addiction(x, y), result1);
|
||||
Assert.AreEqual(Calculator1.Subtraction(x, y), result2);
|
||||
Assert.AreEqual(Calculator1.Multipliction(x, y), result3);
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result4);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestMethod4()
|
||||
{
|
||||
double x = 4;
|
||||
double y = 1;
|
||||
|
||||
double result = 4;
|
||||
|
||||
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestMethod5()
|
||||
{
|
||||
double x = 4;
|
||||
double y = 0;
|
||||
|
||||
double result = double.PositiveInfinity;
|
||||
|
||||
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestMethod6()
|
||||
{
|
||||
double x = int.MaxValue;
|
||||
double y = int.MaxValue;
|
||||
|
||||
double result1 = 4294967294;
|
||||
double result2 = 0;
|
||||
double result3 = 4611686014132420609;
|
||||
double result4 = 1;
|
||||
|
||||
Assert.AreEqual(Calculator1.Addiction(x, y), result1);
|
||||
Assert.AreEqual(Calculator1.Subtraction(x, y), result2);
|
||||
Assert.AreEqual(Calculator1.Multipliction(x, y), result3);
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result4);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestMethod7()
|
||||
{
|
||||
long x = int.MaxValue;
|
||||
long y = int.MaxValue;
|
||||
|
||||
double result1 = 4294967294;
|
||||
double result2 = 0;
|
||||
double result3 = 4611686014132420609L;
|
||||
double result4 = 1;
|
||||
|
||||
Assert.AreEqual(Calculator1.Addiction(x, y), result1);
|
||||
Assert.AreEqual(Calculator1.Subtraction(x, y), result2);
|
||||
Assert.AreEqual(Calculator1.Multipliction(x, y), result3);
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result4);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestMethod8()
|
||||
{
|
||||
double x = 2.5;
|
||||
double y = 3.6;
|
||||
|
||||
double result1 = 6.1;
|
||||
double result2 = -1.1;
|
||||
double result3 = 9;
|
||||
double result4 = 0.69444444444444444444444444444444;
|
||||
|
||||
Assert.AreEqual(Calculator1.Addiction(x, y), result1);
|
||||
Assert.AreEqual(Calculator1.Subtraction(x, y), result2);
|
||||
Assert.AreEqual(Calculator1.Multipliction(x, y), result3);
|
||||
Assert.AreEqual(Calculator1.Division(x, y), result4);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user