public void SwapABTests(double a, double b, double expectedA, double expectedB) { Task2.SwapAB(ref a, ref b); double actualA = a; double actualB = b; Assert.AreEqual(expectedA, actualA); Assert.AreEqual(expectedB, actualB); }
/// <inheritdoc /> public ITask <LogEntry> this[LogEntryIndex index] { get { lock (_syncRoot) { return(Task2.FromResult(_entries[(int)index])); } } }
static void Main(string[] args) { Task1 task1 = new Task1(); task1.SerialiseJson(); Task2 task2 = new Task2(); task2.IterateArray(); }
public void BubbleSortTestAscSum() { int[,] expected = new int[, ] { { 1, 2, 3 }, { 4, 0, 6 }, { 5, 3, 7 } }; int[,] res = Task2.BubbleSort(testedArray, Task2.Orders.Ascending, Task2.Types.SumOfElementsOfRaw); CollectionAssert.AreEqual(expected, res); }
static void Main(string[] args) { var task1 = new Task1(); task1.Execute(); var task2 = new Task2(); task2.Execute(); }
public void BubbleSortTestDesMin() { int[,] expected = new int[, ] { { 5, 3, 7 }, { 1, 2, 3 }, { 4, 0, 6 } }; int[,] res = Task2.BubbleSort(testedArray, Task2.Orders.Descending, Task2.Types.MinOfRaw); CollectionAssert.AreEqual(expected, res); }
private void btnOneKey_Click(object sender, EventArgs e) { Task.Run(() => { btnCheckLED_Click(null, null); Task1.Wait(); btnPutError_Click(null, null); Task2.Wait(); btnPutSuccess_Click(null, null); }); }
public void Day4_AreEqual() { Assert.Multiple(() => { Assert.IsTrue(Task2.AreEqual("aabbcc", "abcabc")); Assert.IsTrue(Task2.AreEqual("abc", "cab")); Assert.IsFalse(Task2.AreEqual("aaa", "bbb")); Assert.IsFalse(Task2.AreEqual("abcdef", "abcdeg")); }); }
static void Main(string[] args) { Func <Task2, string> TaskSolver = task => { const int padding = Task2.Padding; const int decoratingSingsCount = padding / 2; return($"{new string(task.DecorativeSign, decoratingSingsCount), -padding}{ task.Balance:C}{new string( task.DecorativeSign, decoratingSingsCount), padding}"); }; Task2.CheckSolver(TaskSolver); }
public void FindNextBiggerNumberTes() { Task2 item = new Task2(); long number = 12; long expectedResult = 21; long result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 513; expectedResult = 531; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 2017; expectedResult = 2071; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 414; expectedResult = 441; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 1234321; expectedResult = 1241233; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 1234126; expectedResult = 1234162; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 3456432; expectedResult = 3462345; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 144; expectedResult = 414; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 10; expectedResult = -1; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); number = 20; expectedResult = -1; result = item.FindNextBiggerNumber(number); Assert.AreEqual(expectedResult, result); }
public void FindNextBiggerNumber_2017_2071returned() { //arrange int testNumber = 2017; int expected = 2071; //act int actual = Task2.FindNextBiggerNumber(testNumber); //assert Assert.AreEqual(expected, actual); }
public void FindNextBiggerNumber_513_531returned() { //arrange int testNumber = 513; int expected = 531; //act int actual = Task2.FindNextBiggerNumber(testNumber); //assert Assert.AreEqual(expected, actual); }
public void FindNextBiggerNumber_10_nullreturned() { //arrange int testNumber = 10; int expected = -1; //act int actual = Task2.FindNextBiggerNumber(testNumber); //assert Assert.AreEqual(expected, actual); }
public void FindNextBiggerNumber_12_21returned() { //add int testNumber = 12; int expected = 21; //act int actual = Task2.FindNextBiggerNumber(testNumber); //assert Assert.AreEqual(expected, actual); }
public void FindNextBiggerNumber_3456432_3462345returned() { //arrange int testNumber = 3456432; int expected = 3462345; //act int actual = Task2.FindNextBiggerNumber(testNumber); //assert Assert.AreEqual(expected, actual); }
public void TestThereAreNoLikes() { //Arrange var names = new List <string>(); var expectedResult = "no one likes this"; //Act var result = new Task2().ViewLikes(names); //Assert Assert.AreEqual(expectedResult, result); }
public void FindNextBiggerNumber_144_414returned() { //arrange int testNumber = 144; int expected = 414; //act int actual = Task2.FindNextBiggerNumber(testNumber); //assert Assert.AreEqual(expected, actual); }
public void FindNextBiggerNumber_1234126_1234162returned() { //arrange int testNumber = 1234126; int expected = 1234162; //act int actual = Task2.FindNextBiggerNumber(testNumber); //assert Assert.AreEqual(expected, actual); }
static void Main(string[] args) { Func <Task2, string> TaskSolver = task => { const int halfPadding = Task2.Padding / 2; string decorativeSigns = new string(task.DecorativeSign, halfPadding); return($"{decorativeSigns, -Task2.Padding}{task.Balance:C2}{decorativeSigns, Task2.Padding}"); }; Task2.CheckSolver(TaskSolver); }
public ActionResult Edit([Bind(Include = "TaskID,TaskDescription,TaskTitle,IsDone,TimeStamp,IsAssigned,HelpProviderID,TaskCreatorID")] Task2 task2) { if (ModelState.IsValid) { db.Entry(task2).State = EntityState.Modified; task2.HelpProviderID = User.Identity.GetUserId(); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(task2)); }
public ActionResult Edit([Bind(Include = "Task2ID,TaskDescription,Done,DateStarted,DateCompleted,Category,UserID,Deadline")] Task2 task2) { if (ModelState.IsValid) { db.Entry(task2).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Category = new SelectList(db.Categories, "CategoryID", "CategoryName", task2.Category); ViewBag.UserID = new SelectList(db.Users, "UserID", "UserName", task2.UserID); return(View(task2)); }
public void Any() { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; List <Task2> Tasks = new List <Task2>(); Task2 SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 1"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 2"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 3"; Tasks.Add(SubTask); TempTask.SubTasks = Tasks; Project2 TestProject = new Project2(); TestProject.Description = "This is a test project"; TestProject.Name = "Test Project"; List <Task2> Tasks2 = new List <Task2>(); Tasks2.Add(TempTask); TestProject.Tasks = Tasks2; TestProject.Save(); Project2 TestObject = Project2.Any(new EqualParameter <long>(TestProject.ID, "ID_")); Assert.Equal(TestProject.Description, TestObject.Description); Assert.Equal(TestProject.Name, TestObject.Name); Assert.Equal(1, TestObject.Tasks.Count()); Assert.Equal("Test task", TestObject.Tasks.First().Name); Assert.Equal("This is a test", TestObject.Tasks.First().Description); foreach (Task2 TestSubTask in TestObject.Tasks.First().SubTasks) { Assert.Equal(0, TestSubTask.SubTasks.Count()); Assert.Contains(TestSubTask.Name, new string[] { "Sub task 1", "Sub task 2", "Sub task 3" }); Assert.Equal("This is a test", TestSubTask.Description); Assert.Equal(new DateTime(1900, 1, 1), TestSubTask.DueDate); } }
/// <summary> /// The main. /// </summary> /// <param name="args"> /// The args. /// </param> private static void Main(string[] args) { Task1.Execute(); Task2.Execute(); Task3.Execute(); Task4.Execute(); Task5.Execute(); Task6.Execute(); Task7.Execute(); Task8.Execute(); Task9.Execute(); Task10.Execute(); }
private void btnSave_ServerClick(object sender, EventArgs e) { ArrayList categories = new ArrayList(); ArrayList incidentCategories = new ArrayList(); CollectSelectedValues(grdCategories, categories); Task2.SetGeneralCategories(TaskId, categories); Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "try {window.opener.top.frames['right'].location.href='../Tasks/TaskView.aspx?TaskId=" + TaskId + "';}" + "catch (e){} window.close();", true); }
static void Main(string[] args) { Func <Task2, string> TaskSolver = task => { string pad = "".PadLeft(Task2.Padding / 2, task.DecorativeSign); string spaces = "".PadLeft(Task2.Padding / 2); string balance = task.Balance.ToString("C2", new System.Globalization.CultureInfo("en-US")); return($"{pad}{spaces}{balance}{spaces}{pad}"); }; Task2.CheckSolver(TaskSolver); }
private void button2_Click(object sender, EventArgs e) { Task2 p = new Task2(); Recording rec = new Recording(Directory.GetCurrentDirectory() + "/Binary.bin"); long[] arr_det = rec.Search_quanitity(); int[] arr_auxiliary = p.Random_Rows_Colums(); int[,] arr_main = p.Array_Creater(arr_auxiliary[0], arr_auxiliary[1]); int[,] h = rec.Read_Bin(); int m = p.Taker(Convert.ToInt16(textBox2.Text), Convert.ToInt16(textBox1.Text), arr_det[2], arr_det[1], h); MessageBox.Show(Convert.ToString(m)); }
static void Main(string[] args) { Func <Task2, string> TaskSolver = task => { // Your solution goes here // You can get all needed inputs from task.[Property] // Good luck! return("My answer"); }; Task2.CheckSolver(TaskSolver); }
static void Main(string[] args) { Func <Task2, string> TaskSolver = task => { System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US"); return($"{Decor(task.DecorativeSign, Task2.Padding)}" + $"{task.Balance:C2}" + $"{Decor(task.DecorativeSign, Task2.Padding, true)}"); }; Task2.CheckSolver(TaskSolver); }
// GET: Task2/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Task2 task2 = db.Task2s.Find(id); if (task2 == null) { return(HttpNotFound()); } return(View(task2)); }
static void Main(string[] args) { Func <Task2, string> TaskSolver = task => { var enUSCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US"); string paddingFillerString = new string(task.DecorativeSign, Task2.Padding / 2); FormattableString balanceMessage = $"{paddingFillerString,-Task2.Padding}{task.Balance:C}{paddingFillerString,Task2.Padding}"; return(balanceMessage.ToString(enUSCulture)); }; Task2.CheckSolver(TaskSolver); }
static void Main() { int[] arr = {142,3432,4234,4,32,2332}; long count = Task1.Compute(arr); int[,] matrix = { {5222, 34, 34, 5, 23, 1}, {234, 543, 5345, 32, 2, 1} }; Task2 calculate = new Task2(); long counter = calculate.CalculateCount(matrix); Task3 calc = new Task3(); long newCalculate = calc.CalcSum(matrix, 0); }
public void All() { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; List<Task2> Tasks = new List<Task2>(); Task2 SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 1"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 2"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 3"; Tasks.Add(SubTask); TempTask.SubTasks = Tasks; Project2 TestProject = new Project2(); TestProject.Description = "This is a test project"; TestProject.Name = "Test Project"; List<Task2> Tasks2 = new List<Task2>(); Tasks2.Add(TempTask); TestProject.Tasks = Tasks2; TestProject.Save(); IEnumerable<Task2> TestObject = Task2.All(); foreach (Task2 TestTask in TestObject) { Assert.Contains(TestTask.Name, new string[] { "Sub task 1", "Sub task 2", "Sub task 3", "Test task" }); Assert.Equal("This is a test", TestTask.Description); Assert.Equal(new DateTime(1900, 1, 1), TestTask.DueDate); } }
public void Update2() { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; List<Task2> Tasks = new List<Task2>(); Task2 SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 1"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 2"; SubTask.Save(); TempTask.Save(); TempTask = Task2.Any(new EqualParameter<long>(TempTask.ID, "ID_")); Tasks = new List<Task2>(); Tasks.Add(SubTask); TempTask.SubTasks = Tasks; TempTask.Save(); TempTask = Task2.Any(new EqualParameter<long>(TempTask.ID, "ID_")); Assert.True(TempTask.SubTasks.Any(x => x.ID == SubTask.ID)); }
public void Any() { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; List<Task2> Tasks = new List<Task2>(); Task2 SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 1"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 2"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 3"; Tasks.Add(SubTask); TempTask.SubTasks = Tasks; Project2 TestProject = new Project2(); TestProject.Description = "This is a test project"; TestProject.Name = "Test Project"; List<Task2> Tasks2 = new List<Task2>(); Tasks2.Add(TempTask); TestProject.Tasks = Tasks2; TestProject.Save(); Project2 TestObject = Project2.Any(new EqualParameter<long>(TestProject.ID, "ID_")); Assert.Equal(TestProject.Description, TestObject.Description); Assert.Equal(TestProject.Name, TestObject.Name); Assert.Equal(1, TestObject.Tasks.Count()); Assert.Equal("Test task", TestObject.Tasks.First().Name); Assert.Equal("This is a test", TestObject.Tasks.First().Description); foreach (Task2 TestSubTask in TestObject.Tasks.First().SubTasks) { Assert.Equal(0, TestSubTask.SubTasks.Count()); Assert.Contains(TestSubTask.Name, new string[] { "Sub task 1", "Sub task 2", "Sub task 3" }); Assert.Equal("This is a test", TestSubTask.Description); Assert.Equal(new DateTime(1900, 1, 1), TestSubTask.DueDate); } }
public void Update() { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; List<Task2> Tasks = new List<Task2>(); Task2 SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 1"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 2"; Tasks.Add(SubTask); SubTask = new Task2(); SubTask.Description = "This is a test"; SubTask.DueDate = new DateTime(1900, 1, 1); SubTask.Name = "Sub task 3"; Tasks.Add(SubTask); TempTask.SubTasks = Tasks; Project2 TestProject = new Project2(); TestProject.Description = "This is a test project"; TestProject.Name = "Test Project"; List<Task2> Tasks2 = new List<Task2>(); Tasks2.Add(TempTask); TestProject.Tasks = Tasks2; TestProject.Save(); TestProject.Description = "Test description2"; TestProject.Save(); using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Project2_", "Data Source=localhost;Initial Catalog=ORMTestDatabase3;Integrated Security=SSPI;Pooling=false", CommandType.Text)) { Helper.ExecuteReader(); if (Helper.Read()) { Assert.Equal("Test description2", Helper.GetParameter<string>("Description_", "")); Assert.Equal("Test Project", Helper.GetParameter<string>("Name_", "")); } else { Assert.False(true,"Nothing was inserted"); } } using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Task2_", "Data Source=localhost;Initial Catalog=ORMTestDatabase3;Integrated Security=SSPI;Pooling=false", CommandType.Text)) { Helper.ExecuteReader(); while (Helper.Read()) { Assert.Equal("This is a test", Helper.GetParameter<string>("Description_", "")); Assert.Contains(Helper.GetParameter<string>("Name_", ""), new string[] { "Sub task 1", "Sub task 2", "Sub task 3", "Test task" }); } } }
public void SaveIEnumerableExtension() { List<Task2> Tasks = new List<Task2>(); for (int x = 0; x < 100; ++x) { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; Tasks.Add(TempTask); } Tasks.Save<Task2, long>(); using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Task2_", "Data Source=localhost;Initial Catalog=ORMTestDatabase3;Integrated Security=SSPI;Pooling=false", CommandType.Text)) { Helper.ExecuteReader(); int Counter = 0; while (Helper.Read()) { Assert.Equal("This is a test", Helper.GetParameter<string>("Description_", "")); Assert.Equal("Test task", Helper.GetParameter<string>("Name_", "")); ++Counter; } Assert.Equal(100, Counter); } }
public void Paged2() { for (int x = 0; x < 100; ++x) { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; TempTask.Save(); } IEnumerable<Task2> TestObject = Task2.PagedCommand("SELECT * FROM Task2_ WHERE ID_>@ID", "", 25, 0, new EqualParameter<long>(50, "ID")); Assert.Equal(25, TestObject.Count()); foreach (Task2 TestTask in TestObject) { Assert.InRange(TestTask.ID, 51, 75); } TestObject = Task2.PagedCommand("SELECT * FROM Task2_ WHERE ID_>@ID", "", 25, 1, new EqualParameter<long>(50, "ID")); Assert.Equal(25, TestObject.Count()); foreach (Task2 TestTask in TestObject) { Assert.InRange(TestTask.ID, 76, 100); } TestObject = Task2.PagedCommand("SELECT * FROM Task2_ WHERE ID_>@ID", "", 25, 2, new EqualParameter<long>(50, "ID")); Assert.Equal(0, TestObject.Count()); Assert.Equal(2, Task2.PageCount("SELECT * FROM Task2_ WHERE ID_>@ID", 25, new EqualParameter<long>(50, "ID"))); }
public void Paged() { for (int x = 0; x < 100; ++x) { Task2 TempTask = new Task2(); TempTask.Description = "This is a test"; TempTask.DueDate = new DateTime(1900, 1, 1); TempTask.Name = "Test task"; TempTask.Save(); } IEnumerable<Task2> TestObject = Task2.Paged(); Assert.Equal(25, TestObject.Count()); foreach (Task2 TestTask in TestObject) { Assert.InRange(TestTask.ID, 1, 25); } TestObject = Task2.Paged(CurrentPage: 1); Assert.Equal(25, TestObject.Count()); foreach (Task2 TestTask in TestObject) { Assert.InRange(TestTask.ID, 26, 50); } TestObject = Task2.Paged(CurrentPage: 2); Assert.Equal(25, TestObject.Count()); foreach (Task2 TestTask in TestObject) { Assert.InRange(TestTask.ID, 51, 75); } TestObject = Task2.Paged(CurrentPage: 3); Assert.Equal(25, TestObject.Count()); foreach (Task2 TestTask in TestObject) { Assert.InRange(TestTask.ID, 76, 100); } Assert.Equal(4, Task2.PageCount()); }