public ActionResult GetDate() { var now = DateTime.Now; var obj = new TestDate(); obj.LocalDate = now.ToLocalTime(); obj.LocalStr = now.ToLocalTime().ToString(); obj.UTCDate = now.ToUniversalTime(); obj.UTCStr = now.ToUniversalTime().ToString(); return Json(obj); }
public void DateExtremeMax() { //create an instance of the class we want to create clsMaintenance AMaitenance = new clsMaintenance(); //boolean variable to store the results of the vaildation string Error = ""; string TestDescription = "a"; string TestCost = ""; //create the variable DateTime TestDate; //set the date today TestDate = DateTime.Now.Date; //change the to less than 100 years ago TestDate = TestDate.AddYears(100); //convert the date varialbe to string varibale string Date = TestDate.ToString(); //invoke the method Error = AMaitenance.Valid(TestDescription, TestCost, Date); //test to see that the result iss correct Assert.AreNotEqual(Error, ""); }
public void SizeMid() { try { ClsStock Stock = new ClsStock(); String Error = ""; int TestDate; TestDate = 100000; string DateAdded = TestDate.ToString(); Error = Stock.Valid(Name, Release, Quantity, Price, Size); Assert.AreEqual(Error, ""); } catch (Exception) { } }
public void AppointmentDateExtremeMax() { //create an instance of a class clsAppointments TestAppointmentDate = new clsAppointments(); //boolean varibale to store the result of the validation Boolean OK = false; //create some test data to pass to the method string AppointmentDetails = "Software Upgrade"; //create varible to store the test date data DateTime TestDate; //set the date to todays date TestDate = DateTime.Now.Date.AddDays(1000); //change the date to whatever the date minus 365 days TestDate = TestDate.Date; //convert the date variable to a string variable string AppointmentDate = TestDate.ToString(); //invoke the method OK = TestAppointmentDate.ValidAppointmentDate(AppointmentDetails, AppointmentDate); //test to see that the result is correct Assert.IsFalse(OK); }
public void DeadlineDateExtremeMax() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //boolean variable to store the result of search Boolean OK = false; //Create some test data to use with the method. string DaysInForRepair = "10"; string PartPrice = "12.99"; string PartRequired = "Some part"; string CarID = "1023"; string StaffID = "1"; DateTime TestDate; TestDate = DateTime.Now.Date; TestDate = TestDate.AddDays(1000); string DeadlineDate = TestDate.ToString(); //Invoke the method OK = AnCarRepair.Valid(DaysInForRepair, DeadlineDate, PartPrice, PartRequired, CarID, StaffID); //Test to see that the result is correct. Assert.IsFalse(OK); }
public void DateUpdatedExtremeMin() { //create an instance of the class we want to create clsStock AStock = new clsStock(); //string variable to store any error message String Error = ""; //create a variable to store the test date data DateTime TestDate; //set the date totodays date TestDate = DateTime.Now.Date; //change the date to whatever the date is less 100 years TestDate = TestDate.AddYears(-100); //convert the date variable to a string variable string DateUpdated = TestDate.ToString(); //invoke the method Error = AStock.Valid(ProductID, Quantity, Location, Price, DateUpdated); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void OrderDateMin() { //create an instance of the class I want to create clsOrder AnOrder = new clsOrder(); //boolean variable to store the result of the validation Boolean OK = false; //Create some test data to pass to the method String HouseNo = "5"; String Street = "Test Street"; String Town = "Test Town"; String Postcode = "xxx xxx"; //create a variable to store the test data DateTime TestDate; //set the date to todays date TestDate = DateTime.Now.Date; //convert the date variable to a string variable String OrderDate = TestDate.ToString(); //invoke the method OK = AnOrder.Valid(HouseNo, Street, Town, Postcode, OrderDate); //test to see that the result is correct Assert.IsTrue(OK); }
public void EstimatedCompletionDateExtremeMax() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string ProjectName = "Website Creation"; string ProjectDescription = "A new Website was created"; //create a variable to store the test date data DateTime TestDate; //set the date totodays date TestDate = DateTime.Now.Date; //change the date to whatever the date is less 100 years TestDate = TestDate.AddYears(100); //convert the date variable to a string variable string EstimatedCompletionDate = TestDate.ToString(); //invoke the method OK = AProject.Valid(ProjectName, ProjectDescription, EstimatedCompletionDate); //test to see that the result is correct Assert.IsFalse(OK); }
public int CompareTo(StudentTestResult other) { if (FirstName != other.FirstName) { return(FirstName.CompareTo(other.FirstName)); } if (LastName != other.LastName) { return(LastName.CompareTo(other.LastName)); } if (TestName != other.TestName) { return(TestName.CompareTo(other.TestName)); } if (TestDate != other.TestDate) { return(TestDate.CompareTo(other.TestDate)); } return(Score.CompareTo(other.Score)); }
public void DateOfBirthMax() { //Create an instance of the class we want toc reate clsCustomer ACustomer = new clsCustomer(); //String variable to store an error message String Error = ""; //Create some test data to pass to the method string FirstName = "David"; string LastName = "Haddock"; //Create a variable to store test data DateTime TestDate; //Set the date TestDate = DateTime.Now; string DateOfBirth = TestDate.ToString(); string EmailAddress = "*****@*****.**"; string MobilePhoneNo = "07775828423"; string Password = "******"; //Invoke the method Error = ACustomer.Valid(FirstName, LastName, DateOfBirth, EmailAddress, MobilePhoneNo, Password); //Test to see that the result is correct Assert.AreEqual(Error, ""); }
public void Expected_Return_DateMin() { //create an instance of the class we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error messages String Error = ""; //create some test data to pass to the method string Stock_ID = "5678"; string Order_Date = "12/01/2018"; string Customer_ID = "123456"; string Payment_Method = "Card"; //create a variable to store the test date data DateTime TestDate; //Set the date to todays date TestDate = DateTime.Now.Date; //convert the date variable to string variable string Expected_Return_Date = TestDate.ToString(); //invoke the method Error = AnOrder.Valid(Stock_ID, Expected_Return_Date, Order_Date, Customer_ID, Payment_Method); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
private bool PrvParseData(string[] sInput) { try { if (sInput[0] != RecordType) { return(false); } _prvSeqNumber.PubFieldData = sInput[_prvSeqNumber.PubFieldIndex - 1]; _prvTestIdString.PubFieldData = sInput[_prvTestIdString.PubFieldIndex - 1]; _prvDataValue.PubFieldData = sInput[_prvDataValue.PubFieldIndex - 1]; string[] sTemp = _prvTestIdString.PubFieldData.Split(ComponentDelimiter); TestId = sTemp[3]; ResultAspects = sTemp[7]; _prvUnits.PubFieldData = sInput[_prvUnits.PubFieldIndex - 1]; _prvDateTestCompleted.PubFieldData = sInput[_prvDateTestCompleted.PubFieldIndex - 1]; TestDate = _prvDateTestCompleted.PubFieldData.Substring(0, 8); TestDate = string.Format("{0}/{1}/{2}", TestDate.Substring(6, 2), TestDate.Substring(4, 2), TestDate.Substring(0, 4)); return(true); } catch (Exception) { return(false); } }
// Combine date result and value public String GetFormattedResultDate() { string date = string.Format("On {0} : {1}", TestDate.ToString("dd/MM/yyyy"), Status.ToString()); return(date); }
public bool Eq(TestDate test) { return(s == test.s && a == test.a && b == test.b); }