Пример #1
0
        public void GetPropertyValueBoxed()
        {
            Tester tester = new Tester();
            var id = LateBinder.GetProperty(tester, "Id");

            Assert.AreEqual(888, id);
        }
Пример #2
0
        public void GetPropertyValue()
        {
            Tester tester = new Tester();
            string name = LateBinder.GetProperty(tester, "Name").ToString();

            Assert.AreEqual("test", name);
        }
Пример #3
0
        public void SetPropertyValue()
        {
            Tester tester = new Tester();
            LateBinder.SetProperty(tester, "Name", "New Name");

            Assert.AreEqual("New Name", tester.Name);
        }
Пример #4
0
    public bool TestCreateOverArray(Tester t)
    {
        for (int i = 0; i < 2; i++) {
            var ints = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            // Try out two ways of creating a slice:
            Slice<int> slice;
            if (i == 0) {
                slice = new Slice<int>(ints);
            }
            else {
                slice = ints.Slice();
            }
            t.AssertEqual(ints.Length, slice.Length);

            // Now try out two ways of walking the slice's contents:
            for (int j = 0; j < ints.Length; j++) {
                t.AssertEqual(ints[j], slice[j]);
            }
            {
                int j = 0;
                foreach (var x in slice) {
                    t.AssertEqual(ints[j], x);
                    j++;
                }
            }
        }
        return true;
    }
Пример #5
0
        public void SetPropertyValueBoxed()
        {
            Tester tester = new Tester();
            LateBinder.SetProperty(tester, "Id", 999);

            Assert.AreEqual(999, tester.Id);
        }
Пример #6
0
        protected void AssertDescription(string expected, Tester tester)
        {
            string description = tester.Description;
            if (description.StartsWith(expected)) return;

            Fail("Expected description to start with \nexpected: <" + expected + ">...\n but was: <" + description + ">");
        }
 public CommandInterpreter(Tester judge, StudentsRepository repository, DownloadManager downloadManager,
     IOManager inputOutputManager)
 {
     this.judge = judge;
     this.repository = repository;
     this.downloadManager = downloadManager;
     this.inputOutputManager = inputOutputManager;
 }
Пример #8
0
        public void SetPropertyValueNestedNull()
        {
            Tester tester = new Tester();

            LateBinder.SetProperty(tester, "Order.OrderAddress.City", "New Description");

            Assert.AreEqual("New Description", tester.Order.OrderAddress.City);
        }
        public void AsIfOfCorrectTypeInvokesMethod()
        {
            var tester = new Tester();

            tester.AsIf<ITester>(x => x.Method());

            Assert.Equal(1, tester.MethodCounter);
        }
Пример #10
0
        public void SetPropertyValueNestedObject()
        {
            Tester tester = new Tester();
            tester.Order = new Order();

            LateBinder.SetProperty(tester, "Order.OrderAddress", new OrderAddress { Zip = "55346" });

            Assert.AreEqual("55346", tester.Order.OrderAddress.Zip);
        }
Пример #11
0
        public void GetPropertyValueNested()
        {
            Tester tester = new Tester();
            tester.Order = new Order();

            string name = LateBinder.GetProperty(tester, "Order.Id").ToString();

            Assert.AreEqual("123", name);

        }
Пример #12
0
        public void SetPropertyValueNested()
        {
            Tester tester = new Tester();
            tester.Order = new Order();

            LateBinder.SetProperty(tester, "Order.Description", "New Description");

            Assert.AreEqual("New Description", tester.Order.Description);

        }
		public void GetPropertyName()
		{
			Assert.AreEqual("TestReadOnly", ExpressionUtility.GetPropertyName((Tester t) => t.TestReadOnly));
			Assert.AreEqual("TestReadWrite", ExpressionUtility.GetPropertyName((Tester t) => t.TestReadWrite));

			Tester tester = new Tester();
			Assert.AreEqual("TestReadOnly", ExpressionUtility.GetPropertyName(() => tester.TestReadOnly));
			Assert.AreEqual("TestReadWrite", ExpressionUtility.GetPropertyName(() => tester.TestReadWrite));

			Assert.AreEqual("TestStaticReadOnly", ExpressionUtility.GetPropertyName(() => Tester.TestStaticReadOnly));
			Assert.AreEqual("TestStaticReadWrite", ExpressionUtility.GetPropertyName(() => Tester.TestStaticReadWrite));
		}
Пример #14
0
 public bool TestCast(Tester t)
 {
     var ints = new int[100000];
     Random r = new Random(42324232);
     for (int i = 0; i < ints.Length; i++) { ints[i] = r.Next(); }
     var bytes = ints.Slice().Cast<int, byte>();
     t.Assert(bytes.Length == ints.Length * sizeof(int));
     for (int i = 0; i < ints.Length; i++) {
         t.AssertEqual(bytes[i*4], (ints[i]&0xff));
         t.AssertEqual(bytes[i*4+1], (ints[i]>>8&0xff));
         t.AssertEqual(bytes[i*4+2], (ints[i]>>16&0xff));
         t.AssertEqual(bytes[i*4+3], (ints[i]>>24&0xff));
     }
     return true;
 }
Пример #15
0
    public bool TestSubslice(Tester t)
    {
        var slice = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }.Slice();

        // First a simple subslice over the whole array, using start.
        {
            var subslice1 = slice.Sub(0);
            t.AssertEqual(slice.Length, subslice1.Length);
            for (int i = 0; i < slice.Length; i++) {
                t.AssertEqual(slice[i], subslice1[i]);
            }
        }

        // Next a simple subslice over the whole array, using start and end.
        {
            var subslice2 = slice.Sub(0, slice.Length);
            t.AssertEqual(slice.Length, subslice2.Length);
            for (int i = 0; i < slice.Length; i++) {
                t.AssertEqual(slice[i], subslice2[i]);
            }
        }

        // Now do something more interesting; just take half the array.
        {
            int mid = slice.Length/2;
            var subslice3 = slice.Sub(mid);
            t.AssertEqual(mid, subslice3.Length);
            for (int i = mid, j = 0; i < slice.Length; i++, j++) {
                t.AssertEqual(slice[i], subslice3[j]);
            }
        }
 
        // Now take a hunk out of the middle.
        {
            int st = 3;
            int ed = 7;
            var subslice4 = slice.Sub(st, ed);
            t.AssertEqual(ed-st, subslice4.Length);
            for (int i = ed, j = 0; i < ed; i++, j++) {
                t.AssertEqual(slice[i], subslice4[j]);
            }
        }

        return true;
    }
Пример #16
0
	public static int Main()
	{
		Tester tester = new Tester();
		string [] list = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L" };
		int top = 0;
			
		foreach (string s in tester){
			if (s != list [top]){
				Console.WriteLine ("Failure, got {0} expected {1}", s, list [top]);
				return 1;
			}
			top++;
		}
		if (top != list.Length){
			Console.WriteLine ("Failure, expected {0} got {1}", list.Length, top);
		}
		Console.WriteLine ("Success");
		return 0;
	}
Пример #17
0
    public bool TestCreateOverString(Tester t)
    {
        var str = "Hello, Slice!";
        Slice<char> slice = str.Slice();
        t.AssertEqual(str.Length, slice.Length);

        // Now try out two ways of walking the slice's contents:
        for (int j = 0; j < str.Length; j++) {
            t.AssertEqual(str[j], slice[j]);
        }
        {
            int j = 0;
            foreach (var x in slice) {
                t.AssertEqual(str[j], x);
                j++;
            }
        }
        return true;
    }
Пример #18
0
    public bool TestCreateOverPointer(Tester t)
    {
        unsafe {
            byte* buffer = stackalloc byte[256];
            for (int i = 0; i < 256; i++) { buffer[i] = (byte)i; }
            Slice<byte> slice = new Slice<byte>(buffer, 256);
            t.AssertEqual(256, slice.Length);

            // Now try out two ways of walking the slice's contents:
            for (int j = 0; j < slice.Length; j++) {
                t.AssertEqual(buffer[j], slice[j]);
            }
            {
                int j = 0;
                foreach (var x in slice) {
                    t.AssertEqual(buffer[j], x);
                    j++;
                }
            }
        }
        return true;
    }
Пример #19
0
 /// <summary>
 /// Create a tester for a nested control.  Use this constructor when 
 /// the control you are testing is nested within another control,
 /// such as a DataGrid or UserControl.  You should also use this
 /// constructor when you're not using the 
 /// <see cref="HttpClient.Default"/> HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)</param>
 /// 
 /// <example>
 /// This example demonstrates how to test a label that's inside
 /// of a user control:
 /// 
 /// <code>
 /// UserControlTester user1 = new UserControlTester("user1");
 /// LabelTester label = new LabelTester("label", user1);</code>
 /// </example>
 /// 
 /// <example>This example demonstrates how to use an HttpClient
 /// other than <see cref="HttpClient.Default"/>:
 /// 
 /// <code>
 /// HttpClient myHttpClient = new HttpClient();
 /// WebForm currentWebForm = new WebForm(myHttpClient);
 /// LabelTester myTester = new LabelTester("id", currentWebForm);</code>
 /// </example>
 public LabeledControlTester(string aspId, Tester container)
     : base(aspId, container)
 {
 }
Пример #20
0
 /// <summary>
 /// Create a tester for an HTML tag that's on a page with multiple forms using
 /// an XPath description.
 /// </summary>
 /// <param name="xpath">The XPath description of the tag.</param>
 /// <param name="description">A human-readable description of this tag (for error reporting).</param>
 /// <param name="container">A tester for the control's container.  A WebFormTester
 /// will usually be most appropriate.</param>
 public HtmlTextAreaTester(string xpath, string description, Tester container)
     : base(xpath, description, container)
 {
 }
Пример #21
0
 static void Main(string[] args)
 {
     Tester.Run("../../../../Data/Full.xml");
 }
Пример #22
0
 public TraverseFoldersCommand(string input, string[] data, Tester judge, StudentsRepository repository, IOManager inputOutputManager)
     : base(input, data, judge, repository, inputOutputManager)
 {
 }
Пример #23
0
 public ChangePathAbsoluteCommand(string input, string[] data, Tester tester, StudentRepository repository, IOManager manager)
     : base(input, data, tester, repository, manager)
 {
 }
Пример #24
0
        public void addTest(Test t)
        {
            t.Mark      = BE.Success.failed;
            t.Mirror    = false;
            t.Parking   = false;
            t.Reverse   = false;
            t.Signaling = false;
            t.priority  = false;
            t.passed    = BE.Success.failed;
            if (getTestsList().Exists(x => x.Parking == t.Parking || x.priority == t.priority || x.Reverse == t.Reverse || x.Signaling == t.Signaling || x.Mark == t.Mark))
            {
                throw new Exception("You didnt pass the test");
            }
            if (!(getTestersList().Exists(x => x.ID == t.TesterId)) || !(getTraineeList().Exists(x => x.ID == t.TraineeId)))
            {
                throw new Exception("We don't have in our system this trainee's ID or tester's ID");
            }
            int day = (int)t.Date.DayOfWeek;

            if (day > 5)
            {
                throw new Exception("worng day");//checks wrong day
            }
            if (t.Hour < 9 || t.Hour > 15)
            {
                throw new Exception("worng hour");                                        //checks wrong hour
            }
            Tester testerOfTheTest = getTestersList().Find(x => x.ID == t.TesterId);      //checks if id exsist in tester list

            if (testerOfTheTest.MaxTests == sumOfTestsInWeek(t.Date, testerOfTheTest.ID)) //max test in week
            {
                DateTime temp = t.Date.AddDays(7);
                throw new Exception("The tester passed the number of weekly tests. you can try this date:" + temp.ToString());
            }
            if (testerOfTheTest.ScheduleMatrix[day, (t.Hour - 9)] == false)//date
            {
                throw new Exception("this tester doesn't work in this hour in this day ");
            }

            if (getTestsList().Find(x => x.TesterId == testerOfTheTest.ID && x.Date == t.Date && x.Hour == t.Hour) != null)//בדיקה שלטסטר אין מבחן אחר
            {
                DateTime date = AnotherDateForTest(t.Date, t.Hour);
                throw new Exception("this tester already has a test in this hour in this day. You can change to: " + date.ToString());
            }
            Trainee traineeOfTheTest = getTraineeList().Find(x => x.ID == t.TraineeId);

            if (getTestsList().Find(x => x.TraineeId == traineeOfTheTest.ID && x.Date == t.Date && x.Hour == t.Hour) != null)//checks tester doesnt have a test at the same time
            {
                throw new Exception("this trainee already has a test in this hour in this day");
            }

            if (!(getTraineeList().Exists(x => x.ID == ((BE.Test)t).TraineeId)))//id check
            {
                throw new Exception(" trainee's ID not found");
            }
            if (!(getTestersList().Exists(x => x.ID == ((BE.Test)t).TesterId)))
            {
                throw new Exception(" tester's ID not found");
            }
            var tempTrainee = getTraineeList().Find(x => x.ID == ((BE.Test)t).TraineeId);
            var tempTester  = getTestersList().Find(x => x.ID == ((BE.Test)t).TesterId);
            int numOfDays   = (DateTime.Today.Day) - tempTrainee.DateLastTest.Day;

            if (tempTester.TesterGearBox != tempTrainee.TraineeGearbox)// same gearbox for tester and trainee
            {
                throw new Exception("The  tester's gearbox and the  trainee's gearbox are differents");
            }
            if (tempTester.My_Car != tempTrainee.TraineeTypeCar)//same car type for tester and trainee
            {
                throw new Exception("The  tester's Kind Of Vehicle and the  trainee's Kind Of Vehicle are differents");
            }
            if (tempTrainee.NumOfTests >= 1 && numOfDays > BE.Configuration.rangeBetweenTests)//range between tests
            {
                var tempTest = getTestsList().Find(x => x.TraineeId == tempTrainee.ID);
                if (tempTest.GearBox == tempTrainee.TraineeGearbox && tempTest.Mark == BE.Success.passed && tempTest.TestTypeCar == tempTrainee.TraineeTypeCar)//בדיקה שלא עשה כבר את הבמחן הזה
                {
                    throw new Exception("You already did this test on this vehicle  and passed the test! dont try again!!!");
                }
                else
                {
                    dal.addTest(t);
                    getTraineeList().Find(x => x.ID == ((Test)t).TraineeId).NumOfTests++;
                }
            }
            else if (tempTrainee.NumOfTests >= 1 && numOfDays < BE.Configuration.rangeBetweenTests)
            {
                throw new Exception("the range between your tests is too small and needs to be at least over" + BE.Configuration.rangeBetweenTests.ToString() + " days ");
            }
            if (tempTrainee.NumOfTests == 0 && tempTrainee.NumOFLesson >= BE.Configuration.minNumOfLessons)//enough lessons
            {
                dal.addTest(t);
                (getTraineeList().Find(x => x.ID == ((Test)t).TraineeId)).NumOfTests++;
            }
            else
            {
                throw new Exception("you need  at least " + Configuration.minNumOfLessons.ToString() + " lessons");
            }
        }
Пример #25
0
Файл: test.cs Проект: mono/gert
	static void Main ()
	{
		Tester t = new Tester ();
		t.RunTests ();
	}
Пример #26
0
        private void TestSelectedRequests()
        {
            var    customTests = _testFile.GetCustomTests().Values;
            Tester tester      = new Tester(this, _testFile);

            if (_requestsToTest.Count == 0)
            {
                //load the requests to test
                foreach (var tvReqInfo in _selectedRequests)
                {
                    _requestsToTest.Enqueue(tvReqInfo);
                }
            }

            _trafficFile.SetState(AccessorState.Loading);

            while (_runnable && _requestsToTest.Count > 0)
            {
                TVRequestInfo workingEntry = _requestsToTest.Peek();
                //check the request;
                byte[]          reqBytes       = _trafficFile.LoadRequestData(workingEntry.Id);
                byte[]          respBytes      = _trafficFile.LoadResponseData(workingEntry.Id);
                HttpRequestInfo workingReqInfo = null;
                if (reqBytes == null)
                {
                    Log("SELECT A NEW REQUEST");
                    _requestsToTest.Dequeue(); //remove the request;
                    continue;
                }
                else
                {
                    workingReqInfo          = new HttpRequestInfo(reqBytes, true);
                    workingReqInfo.IsSecure = workingEntry.IsHttps;
                }


                string rawRequest  = workingReqInfo.ToString();
                string rawResponse = respBytes != null?Constants.DefaultEncoding.GetString(respBytes) : String.Empty;

                if (ShouldBeTested(rawRequest, _testFile.GetAttackTargetList()))
                {
                    MultiThreadedTestExecution testExecution = new MultiThreadedTestExecution(tester, rawRequest, rawResponse, new Uri(workingReqInfo.FullUrl), _testFile.NumberOfThreads);

                    bool containsFuzz = rawRequest.Contains(Constants.FUZZ_STRING);

                    foreach (CustomTestDef testDef in customTests)
                    {
                        if (containsFuzz)
                        {
                            testExecution.TestsQueue.Enqueue(new TestJob(String.Empty, String.Empty, RequestLocation.Path, testDef));
                        }
                        else
                        {
                            //iterate through parameters, cookies and headers
                            foreach (var parameter in workingReqInfo.PathVariables)
                            {
                                testExecution.TestsQueue.Enqueue(new TestJob(parameter.Key, parameter.Value, RequestLocation.Path, testDef));
                            }

                            foreach (var parameter in workingReqInfo.QueryVariables)
                            {
                                testExecution.TestsQueue.Enqueue(new TestJob(parameter.Key, parameter.Value, RequestLocation.Query, testDef));
                            }

                            foreach (var parameter in workingReqInfo.BodyVariables)
                            {
                                testExecution.TestsQueue.Enqueue(new TestJob(parameter.Key, parameter.Value, RequestLocation.Body, testDef));
                            }

                            if (!_testFile.TestOnlyParameters)
                            {
                                foreach (var header in workingReqInfo.Headers)
                                {
                                    if (!header.Name.Equals("Host"))
                                    {
                                        testExecution.TestsQueue.Enqueue(new TestJob(header.Name, header.Value, RequestLocation.Headers, testDef));
                                    }
                                }

                                foreach (var cookie in workingReqInfo.Cookies)
                                {
                                    testExecution.TestsQueue.Enqueue(new TestJob(cookie.Key, cookie.Value, RequestLocation.Cookies, testDef));
                                }
                            }
                        }
                    }

                    testExecution.StartTestsAsync();

                    while (testExecution.IsRunning)
                    {
                        if (!_runnable)
                        {
                            testExecution.CancelTests();
                        }
                        //wait for the test execution to complete
                        HttpServerConsole.Instance.WriteLine(LogMessageType.Notification,
                                                             "Requests in queue: {0}, Tests in queue for current request: {1}.",
                                                             _requestsToTest.Count, testExecution.TestsQueue.Count);
                        Thread.Sleep(10);
                    }

                    HttpServerConsole.Instance.WriteLine(LogMessageType.Notification,
                                                         "Test execution completed.");
                }
                if (_requestsToTest.Count > 0)
                {
                    _requestsToTest.Dequeue();
                }
            }
        }
Пример #27
0
 public void updateTester(Tester t)
 {
     dal.updateTester(t);
 }
Пример #28
0
        /// <summary>
        ///  DataSoure בנאי של המחלקה
        ///  אתחול 3 הרשימות
        /// </summary>
        public DataSource()
        {
            #region start TeacherList
            DrivingInstructorsAndSchools t1 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "דני אסייג",
                DrivingSchool = "מעוף"
            };
            TeacherList.Add(t1);
            DrivingInstructorsAndSchools t2 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "עוז שמעוני",
                DrivingSchool = "על גלגלים"
            };
            TeacherList.Add(t2);
            DrivingInstructorsAndSchools t3 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "משה פלג",
                DrivingSchool = "אור ירוק"
            };
            TeacherList.Add(t3);
            DrivingInstructorsAndSchools t4 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "טוהר שלם",
                DrivingSchool = "שרייבר"
            };
            TeacherList.Add(t4);
            DrivingInstructorsAndSchools t5 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "רננה צוברי",
                DrivingSchool = "איזי-דרייב"
            };
            TeacherList.Add(t5);
            DrivingInstructorsAndSchools t6 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "שולמית קורן",
                DrivingSchool = "על גלגלים"
            };
            TeacherList.Add(t6);
            DrivingInstructorsAndSchools t7 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "אורי קורן",
                DrivingSchool = "סמארטדרייב"
            };
            TeacherList.Add(t7);
            DrivingInstructorsAndSchools t8 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "טל כהן",
                DrivingSchool = "אופיר"
            };
            TeacherList.Add(t8);
            DrivingInstructorsAndSchools t9 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "תהל מרדכי",
                DrivingSchool = "דרייב2000"
            };
            TeacherList.Add(t9);
            DrivingInstructorsAndSchools t10 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "רונן ישראל",
                DrivingSchool = "עוז"
            };
            TeacherList.Add(t10);
            DrivingInstructorsAndSchools t11 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "איתי בן שלום",
                DrivingSchool = "על גלגלים"
            };
            TeacherList.Add(t11);
            DrivingInstructorsAndSchools t12 = new DrivingInstructorsAndSchools
            {
                TeacherName   = "תהילה לוי",
                DrivingSchool = "אור ירוק"
            };
            TeacherList.Add(t12);
            #endregion

            #region start list
            TesterList  = new List <Tester>();
            TraineeList = new List <Trainee>();
            TestList    = new List <Test>();

            Tester mytester = new Tester();
            {
                mytester.isActive                   = true;
                mytester.TesterId                   = "111111111";
                mytester.TesterLastName             = "לב";
                mytester.TesterFirstName            = "אלעד";
                mytester.TesterDateOfBirth          = new DateTime(1975, 3, 12);
                mytester.TesterFamilyStatus         = FamilyStatus.Married;
                mytester.TesterGender               = Gender.Male;
                mytester.TesterHasGlasses           = true;
                mytester.TesterPhoneNumber          = "0504477332";
                mytester.TesterEmailAddress         = "*****@*****.**";
                mytester.TesterAddress              = new Address("ירושלים", "דוד המלך", 23);
                mytester.TesterYearsOfExperience    = 12;
                mytester.TesterMaxNumOfTestsPerWeek = 10;
                mytester.TesterSpecialization       = TypeOfCar.PrivateCar;
                mytester.MaxiDistanceFromAddress    = 12;
                //TesterImageSource
            };
            TesterList.Add(mytester);
            Tester mytester1 = new Tester();
            {
                mytester1.isActive                   = true;
                mytester1.TesterId                   = "222222222";
                mytester1.TesterLastName             = "פולק";
                mytester1.TesterFirstName            = "איילת";
                mytester1.TesterDateOfBirth          = new DateTime(1970, 5, 28);
                mytester1.TesterFamilyStatus         = FamilyStatus.Single;
                mytester1.TesterGender               = Gender.Female;
                mytester1.TesterHasGlasses           = true;
                mytester1.TesterPhoneNumber          = "0504452932";
                mytester1.TesterEmailAddress         = "*****@*****.**";
                mytester1.TesterAddress              = new Address("חיפה", "יזרעאל", 3);
                mytester1.TesterYearsOfExperience    = 5;
                mytester1.TesterMaxNumOfTestsPerWeek = 3;
                mytester1.TesterSpecialization       = TypeOfCar.PrivateCar;
                mytester1.MaxiDistanceFromAddress    = 32.7;
                //TesterImageSource
            };
            TesterList.Add(mytester1);
            Tester mytester3 = new Tester();
            {
                mytester3.isActive                   = false;
                mytester3.TesterId                   = "444444444";
                mytester3.TesterLastName             = "אלי";
                mytester3.TesterFirstName            = "תומר";
                mytester3.TesterDateOfBirth          = new DateTime(1970, 11, 4);
                mytester3.TesterFamilyStatus         = FamilyStatus.Widower;
                mytester3.TesterGender               = Gender.Male;
                mytester3.TesterHasGlasses           = true;
                mytester3.TesterPhoneNumber          = "0509852932";
                mytester3.TesterEmailAddress         = "*****@*****.**";
                mytester3.TesterAddress              = new Address("תל אביב", "טוהר", 52);
                mytester3.TesterYearsOfExperience    = 5;
                mytester3.TesterMaxNumOfTestsPerWeek = 10;
                mytester3.TesterSpecialization       = TypeOfCar.TwoWheeledVehicles;
                mytester3.MaxiDistanceFromAddress    = 12.7;
                //TesterImageSource
            };
            TesterList.Add(mytester3);
            Tester mytester2 = new Tester();
            {
                mytester2.isActive                   = true;
                mytester2.TesterId                   = "333333333";
                mytester2.TesterLastName             = "כהן";
                mytester2.TesterFirstName            = "רות";
                mytester2.TesterDateOfBirth          = new DateTime(1970, 5, 28);
                mytester2.TesterFamilyStatus         = FamilyStatus.Single;
                mytester2.TesterGender               = Gender.Female;
                mytester2.TesterHasGlasses           = true;
                mytester2.TesterPhoneNumber          = "0504452932";
                mytester2.TesterEmailAddress         = "*****@*****.**";
                mytester2.TesterAddress              = new Address("באר שבע", "שרון", 6);
                mytester2.TesterYearsOfExperience    = 5;
                mytester2.TesterMaxNumOfTestsPerWeek = 8;
                mytester2.TesterSpecialization       = TypeOfCar.HeavyTruck;
                mytester2.MaxiDistanceFromAddress    = 32.7;
                //TesterImageSource
            };
            TesterList.Add(mytester2);
            Tester mytester4 = new Tester();
            {
                mytester4.isActive                   = true;
                mytester4.TesterId                   = "555555555";
                mytester4.TesterLastName             = "רונן";
                mytester4.TesterFirstName            = "שחר";
                mytester4.TesterDateOfBirth          = new DateTime(1975, 3, 12);
                mytester4.TesterFamilyStatus         = FamilyStatus.Married;
                mytester4.TesterGender               = Gender.Female;
                mytester4.TesterHasGlasses           = true;
                mytester4.TesterPhoneNumber          = "0504477332";
                mytester4.TesterEmailAddress         = "*****@*****.**";
                mytester4.TesterAddress              = new Address("ירושלים", "שמשון", 986);
                mytester4.TesterYearsOfExperience    = 12;
                mytester4.TesterMaxNumOfTestsPerWeek = 10;
                mytester4.TesterSpecialization       = TypeOfCar.CarService;
                mytester4.MaxiDistanceFromAddress    = 120;
                //TesterImageSource
            };
            TesterList.Add(mytester4);
            Trainee mytrainee = new Trainee
            {
                TraineeId                     = "111111112",
                TraineeFirstName              = "שרה",
                TraineeLastName               = "לוי",
                TraineeGender                 = Gender.Female,
                TraineePhoneNumber            = "0543811241",
                TraineeEmailAddress           = "*****@*****.**",
                TraineeAddress                = new Address("ירושלים", "תכלת", 23),
                TraineeDateOfBirth            = new DateTime(1997, 5, 17),
                TraineeLearingCar             = TypeOfCar.PrivateCar,
                TraineeGearbox                = TypeOfGearbox.Manual,
                TraineeNameOfSchool           = "מעוף",
                TraineeNameOfTeacher          = "דני אסייג",
                TraineeNumOfDrivingLessons    = 30,
                TraineeHasGlasses             = false,
                IfTraineePassedAnInternalTest = true
                                                //TraineeImageSource
            };
            TraineeList.Add(mytrainee);
            Trainee mytrainee5 = new Trainee
            {
                TraineeId                     = "111111112",
                TraineeFirstName              = "שרה",
                TraineeLastName               = "לוי",
                TraineeGender                 = Gender.Female,
                TraineePhoneNumber            = "0543811241",
                TraineeEmailAddress           = "*****@*****.**",
                TraineeAddress                = new Address("מודיעין", "תכלת", 23),
                TraineeDateOfBirth            = new DateTime(1997, 5, 17),
                TraineeLearingCar             = TypeOfCar.SecurityVehicle,
                TraineeGearbox                = TypeOfGearbox.Automatic,
                TraineeNameOfSchool           = "מעוף",
                TraineeNameOfTeacher          = "דני אסייג",
                TraineeNumOfDrivingLessons    = 30,
                TraineeHasGlasses             = false,
                IfTraineePassedAnInternalTest = true
                                                //TraineeImageSource
            };
            TraineeList.Add(mytrainee5);
            Trainee mytrainee1 = new Trainee
            {
                TraineeId                     = "222222223",
                TraineeFirstName              = "דביר",
                TraineeLastName               = "יוחאי",
                TraineeGender                 = Gender.Male,
                TraineePhoneNumber            = "0504832716",
                TraineeEmailAddress           = "*****@*****.**",
                TraineeAddress                = new Address("תל אביב", "רבין", 123),
                TraineeDateOfBirth            = new DateTime(1999, 10, 23),
                TraineeLearingCar             = TypeOfCar.TwoWheeledVehicles,
                TraineeGearbox                = TypeOfGearbox.Manual,
                TraineeNameOfSchool           = "על גלגלים",
                TraineeNameOfTeacher          = "עוז שמעוני",
                TraineeNumOfDrivingLessons    = 23,
                TraineeHasGlasses             = false,
                IfTraineePassedAnInternalTest = false
                                                //TraineeImageSource
            };
            TraineeList.Add(mytrainee1);
            Trainee mytrainee2 = new Trainee
            {
                TraineeId                     = "333333334",
                TraineeFirstName              = "sosh",
                TraineeLastName               = "levi",
                TraineeGender                 = Gender.Female,
                TraineePhoneNumber            = "0504832116",
                TraineeEmailAddress           = "*****@*****.**",
                TraineeAddress                = new Address("רמות", "תכלת", 23),
                TraineeDateOfBirth            = new DateTime(1980, 10, 23),
                TraineeLearingCar             = TypeOfCar.HeavyTruck,
                TraineeGearbox                = TypeOfGearbox.Manual,
                TraineeNameOfSchool           = "שרייבר",
                TraineeNameOfTeacher          = "טוהר שלם",
                TraineeNumOfDrivingLessons    = 27,
                TraineeHasGlasses             = true,
                IfTraineePassedAnInternalTest = true
                                                //TraineeImageSource
            };
            TraineeList.Add(mytrainee2);
            Criterion c = new Criterion();
            c.AddressingPedestrians = false;
            c.AeactionTime          = false;
            c.ALeapInTheRise        = false;
            c.Bypassing             = false;
            Test mytest = new Test
            {
                TestNumber        = Configuration.NumOfTEST++,
                TesterId          = "222222222",
                TraineeId         = "111111112",
                DateTimeOfTest    = new DateTime(2018, 12, 25, 10, 0, 0),
                TestExitAddress   = new Address("ירושלים", "תכלת", 23),
                TestCriterion     = c,
                TestResult        = PassOrFail.Fail,
                TestTypeOfCar     = TypeOfCar.PrivateCar,
                TestTypeOfGearbox = TypeOfGearbox.Manual,
                TesterNote        = "not good",
            };
            TestList.Add(mytest);
            Test mytest1 = new Test
            {
                TestNumber        = Configuration.NumOfTEST++,
                TesterId          = "444444444",
                TraineeId         = "222222223",
                DateTimeOfTest    = new DateTime(2018, 12, 12, 13, 0, 0),
                TestExitAddress   = new Address("חיפה", "יהודה", 23),
                TestCriterion     = new Criterion(),
                TestResult        = PassOrFail.Pass,
                TestTypeOfCar     = TypeOfCar.TwoWheeledVehicles,
                TestTypeOfGearbox = TypeOfGearbox.Manual,
                TesterNote        = "נסע מהר מידי, לקח פניות במהירות גבוהה, יש לחזק שימוש באיתות",
            };
            TestList.Add(mytest1);
            Test mytest2 = new Test
            {
                TestNumber        = Configuration.NumOfTEST++,
                TesterId          = "333333333",
                TraineeId         = "333333334",
                DateTimeOfTest    = new DateTime(2018, 12, 19, 13, 0, 0),
                TestExitAddress   = new Address("תל אביב", "תכלת", 23),
                TestCriterion     = new Criterion(),
                TestResult        = PassOrFail.Fail,
                TestTypeOfCar     = TypeOfCar.HeavyTruck,
                TestTypeOfGearbox = TypeOfGearbox.Manual,
                TesterNote        = "נסע מהר מידי, לקח פניות במהירות גבוהה, יש לחזק שימוש באיתות",
            };
            TestList.Add(mytest2);
            Test mytest3 = new Test
            {
                TestNumber        = Configuration.NumOfTEST++,
                TesterId          = "111111111",
                TraineeId         = "111111112",
                DateTimeOfTest    = new DateTime(2018, 12, 2, 10, 0, 0),
                TestExitAddress   = new Address("מודיעין", "ורד", 23),
                TestCriterion     = new Criterion(),
                TestResult        = PassOrFail.Fail,
                TestTypeOfCar     = TypeOfCar.PrivateCar,
                TestTypeOfGearbox = TypeOfGearbox.Manual,
                TesterNote        = "not good",
            };
            TestList.Add(mytest3);
            TesterWrokSchedule[,] matrix  = new TesterWrokSchedule[6, 5];
            TesterWrokSchedule[,] matrix1 = new TesterWrokSchedule[6, 5];
            TesterWrokSchedule[,] matrix2 = new TesterWrokSchedule[6, 5];
            for (int k = 0; k < 6; k++)
            {
                for (int t = 0; t < 5; t++)
                {
                    matrix[k, t]  = new TesterWrokSchedule();
                    matrix1[k, t] = new TesterWrokSchedule();
                    matrix2[k, t] = new TesterWrokSchedule();
                }
            }
            for (int k = 0; k < 6; k++)
            {
                for (int t = 0; t < 5; t++)
                {
                    matrix[k, t].DoesWork = true;
                }
            }
            mytester4.MatrixTesterworkdays = matrix;
            mytester1.MatrixTesterworkdays = matrix;
            matrix[1, 0].Available.Add(mytest.DateTimeOfTest, mytest);
            matrix[1, 0].Available.Add(mytest3.DateTimeOfTest, mytest3);
            mytester.MatrixTesterworkdays = matrix;

            for (int k = 0; k < 5; k++)
            {
                for (int t = 1; t < 4; t++)
                {
                    matrix1[k, t].DoesWork = true;
                }
            }

            matrix1[4, 3].Available.Add(mytest1.DateTimeOfTest, mytest1);
            mytester3.MatrixTesterworkdays = matrix1;

            for (int k = 0; k < 5; k++)
            {
                for (int t = 1; t < 4; t++)
                {
                    matrix2[k, t].DoesWork = true;
                }
            }
            matrix2[4, 3].Available.Add(mytest2.DateTimeOfTest, mytest2);
            mytester2.MatrixTesterworkdays = matrix2;
            #endregion
        }
Пример #29
0
 public GetHelpCommand(string input, string[] data, Tester tester, StudentRepository repo, IOManager iOManager) : base(input, data, tester, repo, iOManager)
 {
 }
Пример #30
0
 public SecondDecorator(IService service, Tester tester)
 {
     this.service = service;
     this.tester  = tester;
 }
Пример #31
0
 /// <summary>
 /// Create a tester for a server-side HTML control or a tag that's on a 
 /// page with multiple forms.  Use this constructor when the HTML tag you
 /// are testing has the "runat='server'" attribute.
 /// Also use this tester when using the non-default webform or HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)  If testing a page with multiple forms or a non-default
 /// HttpClient, pass in the WebFormTester for the form this tag is within.</param>
 public HtmlInputTextTester(string aspId, Tester container)
     : base(aspId, container)
 {
 }
Пример #32
0
 public OpenFileCommand(string input, string[] data, Tester judge, StudentsRepository repository, IOManager inputOutputManager)
     : base(input, data, judge, repository, inputOutputManager)
 {
 }
Пример #33
0
 /// <summary>
 /// Create a tester for an HTML tag that's on a page with multiple forms using
 /// an XPath description.
 /// </summary>
 /// <param name="xpath">The XPath description of the tag.</param>
 /// <param name="description">A human-readable description of this tag (for error reporting).</param>
 /// <param name="container">A tester for the control's container.  A WebFormTester
 /// will usually be most appropriate.</param>
 public HtmlInputHidden(string xpath, string description, Tester container)
     : base(xpath, description, container)
 {
 }
Пример #34
0
        public async Task InsertATaskMarkItAsCompletedAndCheckItIsListedOkay()
        {
            // Ensure there is no task already registered

            await ShowThereIsNothingForTheWeekAsync();

            // Create a new task

            const string taskName = "Nova tarefa";

            await CreateANewTaskFromTaskNameAsync(taskName, RoutineTaskDaysValue.WeekEnds);

            // Create another new task

            await CreateANewTaskFromTaskNameAsync(taskName, RoutineTaskDaysValue.WorkDays);

            // Create a third new task

            await CreateANewTaskFromTaskNameAsync(taskName);

            // Request the bot to show the routine for the day

            await Tester.SendMessageAsync(Settings.Commands.Day);

            var response = await Tester.ReceiveMessageAsync();

            var select = response.Content as Select;

            select.ShouldNotBeNull();

            select?.Options.Length.ShouldBe(2);

            // Mark the first task as completed

            await Tester.SendMessageAsync(select?.Options.First().Value);

            response = await Tester.ReceiveMessageAsync();

            var document = response.Content as Select;
            var actual   = document?.Text;

            var expected = Settings.Phraseology.Congratulations;

            expected.ShouldNotBeNull();

            actual.ShouldStartWith(expected);

            // Request the bot to show the routine for the day again

            await Tester.SendMessageAsync(Settings.Commands.Day);

            response = await Tester.ReceiveMessageAsync();

            select = response.Content as Select;
            select.ShouldNotBeNull();

            select?.Options.Length.ShouldBe(1);

            // Cancel the task selection

            await Tester.SendMessageAsync(Settings.Commands.Cancel);

            await Tester.IgnoreMessageAsync();
        }
Пример #35
0
        void Run([CallerMemberName] string testName = null, AssemblerOptions asmOptions = AssemblerOptions.None, CSharpCompilerOptions cscOptions = CSharpCompilerOptions.None, DecompilerSettings decompilerSettings = null)
        {
            var ilFile = Path.Combine(TestCasePath, testName) + Tester.GetSuffix(cscOptions) + ".il";
            var csFile = Path.Combine(TestCasePath, testName + ".cs");

            if (!File.Exists(ilFile))
            {
                // re-create .il file if necessary
                CompilerResults output = null;
                try {
                    output = Tester.CompileCSharp(csFile, cscOptions);
                    Tester.Disassemble(output.PathToAssembly, ilFile, asmOptions);
                } finally {
                    if (output != null)
                    {
                        output.TempFiles.Delete();
                    }
                }
            }

            var executable = Tester.AssembleIL(ilFile, asmOptions);
            var decompiled = Tester.DecompileCSharp(executable, decompilerSettings ?? Tester.GetSettings(cscOptions));

            CodeAssert.FilesAreEqual(csFile, decompiled, Tester.GetPreprocessorSymbols(cscOptions).ToArray());
        }
Пример #36
0
        public async Task InsertTwoNewTasksAndMarkBothAsCompletedInSequence()
        {
            // Ensure there is no task already registered

            await ShowThereIsNothingForTheWeekAsync();

            var hour = DateTime.Now.Hour;
            var time = hour >= 18
                ? RoutineTaskTimeValue.Evening
                : (hour >= 12 ? RoutineTaskTimeValue.Afternoon : RoutineTaskTimeValue.Morning);

            // Create a new task

            const string taskName = "Nova tarefa";

            await CreateANewTaskFromTaskNameAsync(taskName, time : time);

            // Create another new task

            await CreateANewTaskFromTaskNameAsync(taskName, time : time);

            // Request the bot to show the routine for the day

            await Tester.SendMessageAsync(Settings.Commands.Day);

            var response = await Tester.ReceiveMessageAsync();

            var select = response.Content as Select;

            select.ShouldNotBeNull();

            select?.Options.Length.ShouldBe(2);

            // Mark the first task as completed

            await Tester.SendMessageAsync(select?.Options[0].Value);

            response = await Tester.ReceiveMessageAsync();

            var select2 = response.Content as Select;
            var actual  = select2?.Text;

            var expected = Settings.Phraseology.Congratulations;

            expected.ShouldNotBeNull();

            actual.ShouldStartWith(expected);

            // Mark the second task as completed

            await Tester.SendMessageAsync(select?.Options[1].Value);

            response = await Tester.ReceiveMessageAsync();

            var document = response.Content as PlainText;

            actual = document?.Text;

            expected = Settings.Phraseology.CongratulationsNoOtherPendingTask;
            expected.ShouldNotBeNull();

            actual.ShouldBe(expected);

            await Tester.IgnoreMessageAsync();
        }
Пример #37
0
 public void StartsWith_Should_ThrowException_When_NullValue()
 {
     Tester.TestExceptionOnInit <string>(m => m.StartsWith(null), typeof(ArgumentNullException));
 }
Пример #38
0
        public async Task InsertATaskRemoveItAndCheckItIsNotListed()
        {
            // Ensure there is no task already registered

            await ShowThereIsNothingForTheWeekAsync();

            // Create a new task

            const string taskName = "Nova tarefa";

            await CreateANewTaskFromTaskNameAsync(taskName, RoutineTaskDaysValue.WeekEnds);

            // Request the bot to delete a task

            await Tester.SendMessageAsync(Settings.Commands.Delete);

            var response = await Tester.ReceiveMessageAsync();

            var select = response.Content as Select;

            select.ShouldNotBeNull();

            var expected = Settings.Phraseology.ChooseATaskToBeDeleted;

            expected.ShouldNotBeNull();

            var actual = select?.Text;

            actual.ShouldBe(expected);

            select?.Options.Length.ShouldBe(1);

            // Select the first task to be deleted

            await Tester.SendMessageAsync(select?.Options.First().Value);

            response = await Tester.ReceiveMessageAsync();

            select = response.Content as Select;
            select.ShouldNotBeNull();

            expected = Settings.Phraseology.Confirm;
            expected.ShouldNotBeNull();

            actual = select?.Options.First().Text;
            actual.ShouldBe(expected);

            select?.Options.Length.ShouldBe(2);

            // Confirm the deletion

            await Tester.SendMessageAsync(select?.Options.First().Value);

            response = await Tester.ReceiveMessageAsync();

            var document = response.Content as PlainText;

            actual = document?.Text;

            expected = Settings.Phraseology.TheTaskWasRemoved;
            expected.ShouldNotBeNull();

            actual.ShouldBe(expected);

            // Request the bot to show all the tasks

            await ShowThereIsNothingForTheWeekAsync();
        }
Пример #39
0
        public List <TestRecorder> SelectListByTestID(int testID)
        {
            List <TestRecorder> recorderList = new List <TestRecorder>();

            SqlParameter[] parms =
            {
                new SqlParameter("@testID", SqlDbType.Int, 4)
            };
            parms[0].Value = testID;

            using (SqlDataReader dr = DBHelper.Select("UP_T_TestRecorder_GetListByTestID", parms))
            {
                while (dr.Read())
                {
                    TestRecorder recoder = new TestRecorder();
                    recoder.Test.TestID        = testID;
                    recoder.Test.TestName      = dr["testName"].ToString();
                    recoder.Test.PaperType     = (PaperType)dr["paperType"];
                    recoder.Test.Paper.PaperID = Convert.ToInt32(dr["paperID"]);
                    Tester tester = new Tester();
                    recoder.RecorderID = Convert.ToInt32(dr["recorderID"]);
                    tester.UserID      = dr["userID"].ToString();
                    tester.Name        = dr["Name"].ToString();
                    Department dept = new Department();
                    dept.DeptName     = dr["deptName"].ToString();
                    tester.Department = dept;
                    recoder.Tester    = tester;
                    if (!string.IsNullOrEmpty(dr["BeginTestTime"].ToString()))
                    {
                        recoder.BeginTestTime = Convert.ToDateTime(dr["BeginTestTime"]);
                    }
                    else
                    {
                        recoder.BeginTestTime = new DateTime();
                    }

                    if (!string.IsNullOrEmpty(dr["SubmitTestTime"].ToString()))
                    {
                        recoder.SubmitTestTime = Convert.ToDateTime(dr["SubmitTestTime"]);
                    }
                    else
                    {
                        recoder.SubmitTestTime = new DateTime();
                    }

                    recoder.SubmitType = dr["SubmitType"].ToString();
                    recoder.Marked     = Convert.ToBoolean(dr["marked"]);
                    recoder.HasTested  = Convert.ToBoolean(dr["hasTested"]);

                    if (!dr["totalScore"].ToString().Trim().Equals(""))
                    {
                        recoder.TotalScore = Convert.ToInt32(dr["totalScore"]);
                    }
                    //     recoder.TestMark.TotalScore = Convert.ToUInt16(dr["totalScore"]);
                    //recoder.TestMark.Remark = dr["remark"].ToString();

                    recorderList.Add(recoder);
                }
            }

            return(recorderList);
        }
Пример #40
0
        protected async Task CreateANewTaskFromTaskNameAsync(
            string taskName,
            RoutineTaskDaysValue days = RoutineTaskDaysValue.EveryDay,
            RoutineTaskTimeValue time = RoutineTaskTimeValue.Morning,
            bool cancel = false)
        {
            // Inform task name

            await Tester.SendMessageAsync(taskName);

            var response = await Tester.ReceiveMessageAsync();

            response.ShouldNotBeNull();

            var select = response.Content as Select;
            var actual = select?.Text;

            var expected = Settings.Phraseology.WhichDaysShallThisTaskBePerformed;

            expected.ShouldNotBeNull();

            actual.ShouldBe(expected);

            // Inform task day

            await Tester.SendMessageAsync(new PlainText { Text = ((int)days).ToString() });

            response = await Tester.ReceiveMessageAsync();

            response.ShouldNotBeNull();

            select = response.Content as Select;
            actual = select?.Text;

            expected = Settings.Phraseology.WhichTimeShallThisTaskBePerformed;
            expected.ShouldNotBeNull();

            actual.ShouldBe(expected);

            // Inform task time

            await Tester.SendMessageAsync(new PlainText { Text = ((int)time).ToString() });

            response = await Tester.ReceiveMessageAsync();

            response.ShouldNotBeNull();

            select = response.Content as Select;
            actual = select?.Text;

            actual.ShouldStartWith(taskName);

            // Confirm the new task

            await Tester.SendMessageAsync(cancel?Settings.Commands.Cancel : Settings.Commands.Confirm);

            response = await Tester.ReceiveMessageAsync();

            response.ShouldNotBeNull();

            var document = response.Content as PlainText;

            actual = document?.Text;

            expected = cancel ? Settings.Phraseology.WheneverYouNeed : Settings.Phraseology.TheTaskWasRegistered;

            expected.ShouldNotBeNull();

            actual.ShouldBe(expected);
        }
Пример #41
0
 public HtmlAnchorTester(string aspId, Tester container, bool runAtServer)
     : this(aspId, container)
 {
 }
Пример #42
0
        public void NAD1983HARNStatePlaneColoradoCentralFIPS0502Feet()
        {
            ProjectionInfo pStart = KnownCoordinateSystems.Projected.StatePlaneNad1983HarnFeet.NAD1983HARNStatePlaneColoradoCentralFIPS0502Feet;

            Tester.TestProjection(pStart);
        }
Пример #43
0
 /// <summary>
 /// Create a tester for a server-side HTML control or a tag that's on a 
 /// page with multiple forms.  Use this constructor when the HTML tag you
 /// are testing has the "runat='server'" attribute.
 /// Also use this tester when using the non-default webform or HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)  If testing a page with multiple forms or a non-default
 /// HttpClient, pass in the WebFormTester for the form this tag is within.</param>
 public HtmlTextAreaTester(string aspId, Tester container)
     : base(aspId, container)
 {
 }
Пример #44
0
 public void Matches_String_Should_ThrowException_When_NullValue()
 {
     Tester.TestExceptionOnInit <string>(m => m.Matches((string)null), typeof(ArgumentNullException));
 }
Пример #45
0
 /// <summary>
 /// Create the tester and link it to an ASP.NET control.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  (In the page's ASP.NET
 /// source code, look for the tag that the control is nested in.  That's probably the
 /// control's container.  Use CurrentWebForm if the control is just nested in the form tag.)</param>
 public UserControlTester(string aspId, Tester container) : base(aspId, container)
 {
     this.aspId     = aspId;
     this.container = container;
 }
Пример #46
0
 public void Contains_Should_ThrowException_When_NullValue()
 {
     Tester.TestExceptionOnInit <string>(m => m.Contains(null), typeof(ArgumentNullException));
 }
Пример #47
0
 /// <summary>
 /// Create a tester for a nested control.  Use this constructor when 
 /// the control you are testing is nested within another control,
 /// such as a DataGrid or UserControl.  You should also use this
 /// constructor when you're not using the 
 /// <see cref="HttpClient.Default"/> HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)</param>
 /// 
 /// <example>
 /// This example demonstrates how to test a label that's inside
 /// of a user control:
 /// 
 /// <code>
 /// UserControlTester user1 = new UserControlTester("user1");
 /// LabelTester label = new LabelTester("label", user1);</code>
 /// </example>
 /// 
 /// <example>This example demonstrates how to use an HttpClient
 /// other than <see cref="HttpClient.Default"/>:
 /// 
 /// <code>
 /// HttpClient myHttpClient = new HttpClient();
 /// WebForm currentWebForm = new WebForm(myHttpClient);
 /// LabelTester myTester = new LabelTester("id", currentWebForm);</code>
 /// </example>
 public PanelTester(string aspId, Tester container)
     : base(aspId, container)
 {
 }
Пример #48
0
 public void LengthBetween_Should_ThrowException_When_MinGreaterThanMax(int min, int max)
 {
     Tester.TestExceptionOnInit <string>(m => m.LengthBetween(min, max), typeof(ArgumentException));
 }
Пример #49
0
 /// <summary>
 /// Create a tester for a server-side HTML control or a tag that's on a 
 /// page with multiple forms.  Use this constructor when the HTML tag you
 /// are testing has the "runat='server'" attribute.
 /// Also use this tester when using the non-default webform or HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)  If testing a page with multiple forms or a non-default
 /// HttpClient, pass in the WebFormTester for the form this tag is within.</param>
 public HtmlInputHidden(string aspId, Tester container)
     : base(aspId, container)
 {
 }
 /// <summary>
 /// Create a tester for a nested control.  Use this constructor when 
 /// the control you are testing is nested within another control,
 /// such as a DataGrid or UserControl.  You should also use this
 /// constructor when you're not using the 
 /// <see cref="HttpClient.Default"/> HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)</param>
 /// 
 /// <example>
 /// This example demonstrates how to test a label that's inside
 /// of a user control:
 /// 
 /// <code>
 /// UserControlTester user1 = new UserControlTester("user1");
 /// LabelTester label = new LabelTester("label", user1);</code>
 /// </example>
 /// 
 /// <example>This example demonstrates how to use an HttpClient
 /// other than <see cref="HttpClient.Default"/>:
 /// 
 /// <code>
 /// HttpClient myHttpClient = new HttpClient();
 /// WebForm currentWebForm = new WebForm(myHttpClient);
 /// LabelTester myTester = new LabelTester("id", currentWebForm);</code>
 /// </example>
 public RegularExpressionValidatorTester(string aspId, Tester container)
     : base(aspId, container)
 {
 }
Пример #51
0
 /// <summary>
 /// Create a tester for a nested control.  Use this constructor when 
 /// the control you are testing is nested within another control,
 /// such as a DataGrid or UserControl.  You should also use this
 /// constructor when you're not using the 
 /// <see cref="HttpClient.Default"/> HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.  
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)</param>
 /// 
 /// <example>
 /// This example demonstrates how to test a label that's inside
 /// of a user control:
 /// 
 /// <code>
 /// UserControlTester user1 = new UserControlTester("user1");
 /// LabelTester label = new LabelTester("label", user1);</code>
 /// </example>
 /// 
 /// <example>This example demonstrates how to use an HttpClient
 /// other than <see cref="HttpClient.Default"/>:
 /// 
 /// <code>
 /// HttpClient myHttpClient = new HttpClient();
 /// WebForm currentWebForm = new WebForm(myHttpClient);
 /// LabelTester myTester = new LabelTester("id", currentWebForm);</code>
 /// </example>
 public ButtonTester(string aspId, Tester container)
     : base(aspId, container)
 {
 }
Пример #52
0
    public bool TestPerfLoop(Tester t)
    {
        var ints = new int[10000];
        Random r = new Random(1234);
        for (int i = 0; i < ints.Length; i++) { ints[i] = r.Next(); }

        t.CleanUpMemory();

        var sw = System.Diagnostics.Stopwatch.StartNew();
        int x = 0;
        for (int i = 0; i < 10000; i++) {
            for (int j = 0; j < ints.Length; j++) {
                x += ints[i];
            }
        }
        sw.Stop();
        Console.WriteLine("    - ints : {0}", sw.Elapsed);

        t.CleanUpMemory();

        var slice = ints.Slice();
        sw.Reset();
        sw.Start();
        int y = 0;
        for (int i = 0; i < 10000; i++) {
            for (int j = 0; j < slice.Length; j++) {
                y += slice[i];
            }
        }
        sw.Stop();
        Console.WriteLine("    - slice: {0}", sw.Elapsed);

        t.AssertEqual(x, y);
        return true;
    }
Пример #53
0
 public void LengthBetween_Should_ThrowException_When_NegativeLength(int min, int max)
 {
     Tester.TestExceptionOnInit <string>(m => m.LengthBetween(min, max), typeof(ArgumentOutOfRangeException));
 }
Пример #54
0
        public void TestTest()
        {
            // create compiler
            var compiler = new Compiler
            {
                Name              = "CPP",
                Location          = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Compilers\CPP8\Compiler\CL.EXE"),
                Extension         = "cpp",
                Arguments         = "/I\"$CompilerDirectory$\" $SourceFilePath$ /link /LIBPATH:\"$CompilerDirectory$\"",
                CompiledExtension = "exe",
                IsNeedShortPath   = true
            };

            var filePath = Helper.CreateFileForCompilation(
                CompileServiceLanguageSourceCode.CPPCorrectSourceCode, compiler.Extension);
            string output, error;
            var    result = compiler.Compile(filePath, out output, out error);

            if (result)
            {
                filePath = Path.ChangeExtension(filePath, compiler.CompiledExtension);
                Status testingResult;

                // check file path
                try
                {
                    Tester.Test("badFilePath", string.Empty, string.Empty, 1, 1);
                    Assert.AreEqual(true, false);
                }
                catch (Exception)
                {
                    Assert.AreEqual(true, true);
                }

                // check correct timelimit
                try
                {
                    Tester.Test(filePath, string.Empty, string.Empty, -5, 1);
                    Assert.AreEqual(true, false);
                }
                catch (Exception)
                {
                    Assert.AreEqual(true, true);
                }

                // check correct memorylimit
                try
                {
                    Tester.Test(filePath, string.Empty, string.Empty, 1, -5);
                    Assert.AreEqual(true, false);
                }
                catch (Exception)
                {
                    Assert.AreEqual(true, true);
                }

                // test with correct parameters
                try
                {
                    testingResult = Tester.Test(filePath, string.Empty, string.Empty, 10000, 3000);
                    Assert.AreEqual("Accepted", testingResult.TestResult);
                }
                catch (Exception)
                {
                    Assert.AreEqual(true, false);
                }
            }
        }
 /// <summary>
 /// Create a tester for a nested control.  Use this constructor when
 /// the control you are testing is nested within another control,
 /// such as a DataGrid or UserControl.  You should also use this
 /// constructor when you're not using the
 /// <see cref="HttpClient.Default"/> HttpClient.
 /// </summary>
 /// <param name="aspId">The ID of the control to test (look in the
 /// page's ASP.NET source code for the ID).</param>
 /// <param name="container">A tester for the control's container.
 /// (In the page's ASP.NET source code, look for the tag that the
 /// control is nested in.  That's probably the control's
 /// container.)</param>
 ///
 /// <example>
 /// This example demonstrates how to test a label that's inside
 /// of a user control:
 ///
 /// <code>
 /// UserControlTester user1 = new UserControlTester("user1");
 /// LabelTester label = new LabelTester("label", user1);</code>
 /// </example>
 ///
 /// <example>This example demonstrates how to use an HttpClient
 /// other than <see cref="HttpClient.Default"/>:
 ///
 /// <code>
 /// HttpClient myHttpClient = new HttpClient();
 /// WebForm currentWebForm = new WebForm(myHttpClient);
 /// LabelTester myTester = new LabelTester("id", currentWebForm);</code>
 /// </example>
 public RegularExpressionValidatorTester(string aspId, Tester container) : base(aspId, container)
 {
 }
Пример #56
0
 public void MinLength_Should_ThrowException_When_NegativeLength(int argValue)
 {
     Tester.TestExceptionOnInit <string>(m => m.MinLength(argValue), typeof(ArgumentOutOfRangeException));
 }
Пример #57
0
 public MakeDirectoryCommand(string input, string[] data, Tester tester,
                             StudentsRepository repository, DownloadManager downloadManager, IOManager ioManager)
     : base(input, data, tester, repository, downloadManager, ioManager)
 {
 }
 public TraverseFoldersCommand(string input, string[] data, Tester tester,
                               StudentsRepository repository, DownloadManager downloadManager, IOManager ioManager)
     : base(input, data, tester, repository, downloadManager, ioManager)
 {
 }
        public BasicContractZeroTestBase()
        {
            TesterKeyPair = Tester.KeyPair;
            AsyncHelper.RunSync(() =>
                                Tester.InitialChainAsyncWithAuthAsync(Tester.GetDefaultContractTypes(Tester.GetCallOwnerAddress(),
                                                                                                     out TotalSupply,
                                                                                                     out _,
                                                                                                     out BalanceOfStarter)));

            BasicContractZeroAddress   = Tester.GetZeroContractAddress();
            ParliamentAddress          = Tester.GetContractAddress(ParliamentSmartContractAddressNameProvider.Name);
            TokenContractAddress       = Tester.GetContractAddress(TokenSmartContractAddressNameProvider.Name);
            AssociationContractAddress = Tester.GetContractAddress(AssociationSmartContractAddressNameProvider.Name);
        }
Пример #60
0
 public void NotEqualTo_Should_ThrowException_When_NullValue()
 {
     Tester.TestExceptionOnInit <string>(m => m.NotEqualTo(null), typeof(ArgumentNullException));
 }