예제 #1
0
        protected void DataPortal_Insert()
        {
            SqlConnection cn          = new SqlConnection(WellKnownValues.DataPortalTestDatabase);
            string        firstName   = this.FirstName;
            string        lastName    = this.LastName;
            string        smallColumn = this.SmallColumn;

            //this command will always execute successfully
            //since it inserts a string less than 5 characters
            //into SmallColumn
            SqlCommand cm1 = new SqlCommand();

            cm1.Connection  = cn;
            cm1.CommandText = "INSERT INTO Table2(FirstName, LastName, SmallColumn) VALUES('Bill', 'Thompson', 'abc')";

            //this command will throw an exception
            //if SmallColumn is set to a string longer than
            //5 characters
            SqlCommand cm2 = new SqlCommand();

            cm2.Connection = cn;
            //use stringbuilder
            cm2.CommandText  = "INSERT INTO Table2(FirstName, LastName, SmallColumn) VALUES('";
            cm2.CommandText += firstName;
            cm2.CommandText += "', '" + lastName + "', '" + smallColumn + "')";

            cn.Open();
            cm1.ExecuteNonQuery();
            cm2.ExecuteNonQuery();
            cn.Close();

            TestResults.Reinitialise();
            TestResults.Add("TransactionalRoot", "Inserted");
            Console.WriteLine("DataPortal_Insert");
        }
예제 #2
0
 protected void DataPortal_Create()
 {
     TestResults.Reinitialise();
     TestResults.Add("TransactionalRoot", "Created");
     BusinessRules.CheckRules();
     Console.WriteLine("DataPortal_Create");
 }
예제 #3
0
 private void DataPortal_Create(Criteria1 criteria)
 {
     _id = 0;
     TestResults.Reinitialise();
     TestResults.Add("SplitOverload", "Created1");
     BusinessRules.CheckRules();
 }
        private void CaptureTestResults(IEnumerable <TestResult> results)
        {
            var testResults = results as TestResult[] ?? results.ToArray();

            foreach (var testResult in testResults)
            {
                var id = testResult.TestCase.Id;
                if (!_runs.ContainsKey(id))
                {
                    if (_vsTests.ContainsKey(id))
                    {
                        _runs[id] = new TestRun(_vsTests[id]);
                    }
                    else
                    {
                        // unknown id. Probable cause: test name has changed due to some parameter having changed
                        _runs[id] = new TestRun(new VsTestDescription(testResult.TestCase));
                    }
                }

                if (_runs[id].AddResult(testResult))
                {
                    TestResults.Add(_runs[id].Result());
                    _inProgress.Remove(id);
                }
            }
        }
예제 #5
0
        private void DataPortal_Create(object criteria)
        {
            Criteria crit = (Criteria)(criteria);

            _data = crit._data;
            TestResults.Add("GenRoot", "Created");
        }
        private void Test()
        {
            Stopwatchy = new Stopwatch();
            Stopwatchy.Start();
            IWriteContactService writeContactService = DependencyService.Get <IWriteContactService>();
            var random = new Random();

            Stopwatchy.Start();
            var result = writeContactService.WriteContact(new Contact("xamarin", "App", random.Next(1000).ToString()));

            Stopwatchy.Stop();
            TestResults.Add(new TestResult(Stopwatchy.Elapsed.TotalMilliseconds * 1000000, "Test finished successfully"));
            if (--NumberOfIterationsLeft > 0)
            {
                Test();
            }
            else
            {
                var durationSum = 0.0;
                foreach (var testResult in TestResults)
                {
                    durationSum += testResult.Duration;
                }
                var durationAvg = durationSum / TestResults.Count;
                TestResults.Add(new TestResult(durationAvg, "(AVERAGE) ALL TESTS FINISHED"));
            }
        }
예제 #7
0
 protected void DataPortal_Create()
 {
     _id = 0;
     TestResults.Reinitialise();
     TestResults.Add("SplitOverload", "Created");
     BusinessRules.CheckRules();
 }
예제 #8
0
 private void DataPortal_Fetch(OtherCriteria criteria)
 {
     using (BypassPropertyChecks)
         Id = criteria.Id;
     TestResults.Reinitialise();
     TestResults.Add("SingleOverload", "Fetched1");
 }
예제 #9
0
        void Start()
        {
            int TestCounter = 0;

            for (int i = 0; i < TestItemsets.Count; i++)
            {
                FoundItemsetsProperties itemSetProperties = new FoundItemsetsProperties();
                itemSetProperties.testIndex = i;
                ArrayList testItemset = (ArrayList)TestItemsets[i];
                for (int j = 0; j < TrainingSubsets.Count; j++)
                {
                    ArrayList trainingItemset = (ArrayList)TrainingSubsets[j];
                    if (HasSubsumtions_Traditional(trainingItemset, testItemset))
                    {
                        //اولا هنا المفروض هسجل رقم الصف اللى بختبره
                        itemSetProperties.itemsetIndexInTrainingSet.Add(j);
                        //ثانيا هسجل كل كلاس مع خصائص الروول بمعنى هذه الروول اتكررت كام مرة وبها كام فيتشر
                        itemSetProperties.itemsetIndexInTrainingSetClassLabel.Add(FirstFileAsSubsetsClasses[j]);
                        //string x = FirstFileAsSubsetsClasses[j].ToString();
                    }
                    TestCounter++;
                }
                TestResults.Add(itemSetProperties);
            }
            Results_Analysis();
            SetTxtText(Environment.NewLine + ".........Finished..........");
        }
예제 #10
0
        protected override void Test(ArchiveExtraction archive)
        {
            var structure = SerializeUtil.DeserializeFromFile <addml>(archive.GetStructureDescriptionFileName());

            foreach (var entry in structure.dataset[0].dataObjects.dataObject)
            {
                foreach (var currentObject in entry.dataObjects.dataObject)
                {
                    foreach (var fileProperty in currentObject.properties.Where(s => s.name == "file"))
                    {
                        var filename = archive.WorkingDirectory + Path.DirectorySeparatorChar + GetFilenameFromProperty(fileProperty);

                        var checksumAlgorithm = GetChecksumAlgorithmFromProperty(fileProperty);

                        var checksumValue = GetChecksumValueFromProperty(fileProperty);

                        var generatedChecksum = GenerateChecksumForFile(filename, checksumAlgorithm);

                        var checksumsAreEqual = string.Equals(generatedChecksum, checksumValue, StringComparison.InvariantCultureIgnoreCase);

                        var testResult = CreateTestResult(checksumsAreEqual, generatedChecksum, checksumValue, filename, checksumAlgorithm);
                        TestResults.Add(testResult);
                    }
                }
            }
        }
예제 #11
0
파일: Single.cs 프로젝트: gnilesh4/csla
        private void DoInsertUpdate(bool isUpdate)
        {
            var insertOrUpdate = isUpdate ? "Updated" : "Inserted";

            TestResults.Reinitialise();
            TestResults.Add("Single", insertOrUpdate);
            MethodCalled = insertOrUpdate;
        }
예제 #12
0
파일: SimpleRoot.cs 프로젝트: gnilesh4/csla
        /// <summary>
        /// Handles new DataPortal Create calls
        /// </summary>
        /// <param name="criteria"></param>
        private void DataPortal_Create(object criteria)
        {
            Criteria crit = criteria as Criteria;

            this._Data = crit.Data;

            TestResults.Add("Root", "Created");
        }
예제 #13
0
        protected void DataPortal_Fetch(object criteria)
        {
            Criteria crit = (Criteria)(criteria);

            _data = crit._data;
            MarkOld();
            TestResults.Add("GenRoot", "Fetched");
        }
예제 #14
0
 protected void DataPortal_Execute()
 {
     lock (locker)
     {
         TestResults.Add("CommandObject", "DataPortal_Execute called");
         _property = "Executed";
     }
 }
예제 #15
0
        protected void Child_Update()
        {
            TestResults.Add("CustomerContactUpdate", "Updated  Customer Contact" + GetProperty <string>(FirstNameProperty) + ", " + GetProperty <string>(LastNameProperty));
            CustomerContactList parent      = this.Parent as CustomerContactList;
            Customer            grandParent = parent.MyParent;

            LoadProperty(ParentNameProperty, grandParent.Name);
        }
예제 #16
0
 private void DataPortal_Create(Criteria criteria)
 {
     using (BypassPropertyChecks)
         Id = 0;
     TestResults.Reinitialise();
     TestResults.Add("SingleOverload", "Created");
     BusinessRules.CheckRules();
 }
예제 #17
0
 protected void DataPortal_Create()
 {
     using (BypassPropertyChecks)
         Id = 0;
     TestResults.Reinitialise();
     TestResults.Add("SingleOverload", "Created0");
     BusinessRules.CheckRules();
 }
예제 #18
0
 protected void DataPortal_Fetch(object criteria, [Inject] IChildDataPortal <ChildEntityList> dataPortal)
 {
     _children = dataPortal.CreateChild();
     Console.WriteLine("DataPortal_Fetch");
     TestResults.Reinitialise();
     TestResults.Add("ParentEntity", "Fetched");
     BusinessRules.CheckRules();
 }
예제 #19
0
 protected void DataPortal_Create([Inject] IChildDataPortal <ChildEntityList> childDataPortal)
 {
     SetProperty(ChildrenProperty, childDataPortal.CreateChild());
     TestResults.Reinitialise();
     TestResults.Add("ParentEntity", "Created");
     BusinessRules.CheckRules();
     Console.WriteLine("DataPortal_Create");
 }
예제 #20
0
 protected void DataPortal_Update()
 {
     if (this.Items[0].ThrowException)
     {
         throw new Exception();
     }
     TestResults.Add("CustomerUpdate", "Updating Customer List");
 }
예제 #21
0
        protected void DataPortal_Fetch(object criteria)
        {
            Criteria crit = (Criteria)(criteria);

            _name = crit._name;
            MarkOld();
            TestResults.Add("NullableObject", "Fetched");
        }
예제 #22
0
        private void DataPortal_Create(object criteria)
        {
            Criteria crit = (Criteria)(criteria);

            _name = crit._name;
            //Name = crit._name;
            TestResults.Add("NullableObject", "Created");
        }
예제 #23
0
 public void Complete(Server.InterceptArgs e)
 {
     TestResults.Add("Intercept2+" + e.ObjectType.Name, "Complete");
     if (e.Exception != null)
     {
         TestResults.AddOrOverwrite("InterceptException+" + e.ObjectType.Name, e.Exception.Message);
     }
     TestResults.Add("InterceptOp2+" + e.ObjectType.Name, e.Operation.ToString());
 }
예제 #24
0
파일: SimpleRoot.cs 프로젝트: gnilesh4/csla
        /// <summary>
        /// Handles DataPortal fetch calls
        /// </summary>
        /// <param name="criteria"></param>
        protected void DataPortal_Fetch(object criteria)
        {
            Criteria crit = criteria as Criteria;

            this._Data = crit.Data;

            this.MarkOld();
            TestResults.Add("Root", "Fetched");
        }
예제 #25
0
 protected void DataPortal_Create(StronglyTypedDP.Criteria criteria)
 {
     using (BypassPropertyChecks)
     {
         Data = criteria._data;
         Id   = criteria._ID;
     }
     TestResults.Add("StronglyTypedDP", "Created");
 }
예제 #26
0
        private void DataPortal_Create(object criteria)
        {
            Criteria crit = (Criteria)(criteria);

            using (BypassPropertyChecks)
                Name = crit._name;
            TestResults.Add("HasRulesManager", "Created");
            BusinessRules.CheckRules();
        }
예제 #27
0
        private void AddResult(string collectionName, TestResultViewModel testResultViewModel)
        {
            switch (testResultViewModel.Status)
            {
            case ResultStatus.Failed:
                FailedTests++;
                break;

            case ResultStatus.Passed:
                PassedTests++;
                break;

            case ResultStatus.Skipped:
                SkippedTests++;
                break;
            }

            var collection = TestResults.FirstOrDefault(c => c.Name == collectionName);

            if (collection != null)
            {
                var container = collection.TestContainers.FirstOrDefault(c => c.Name == testResultViewModel.Name);

                if (container != null)
                {
                    var sourceCollection = container.TestResults.SourceCollection as ObservableCollection <TestResultViewModel>;
                    if (sourceCollection != null)
                    {
                        sourceCollection.Add(testResultViewModel);
                    }
                }
                else
                {
                    collection.TestContainers.Add(new TestResultContainerViewModel
                    {
                        Name        = testResultViewModel.Name,
                        TestResults = GetTestView(testResultViewModel),
                    });
                }
            }
            else
            {
                // Test Collection didn't exist so add it.
                TestResults.Add(new TestResultCollectionViewModel
                {
                    Name           = collectionName,
                    TestContainers = new ObservableCollection <TestResultContainerViewModel>
                    {
                        new TestResultContainerViewModel
                        {
                            Name        = testResultViewModel.Name,
                            TestResults = GetTestView(testResultViewModel),
                        }
                    }
                });
            }
        }
예제 #28
0
        private void ExtractTestCase(XmlNode nodeTestCase)
        {
            var testcase = new Reporter.TestCase(nodeTestCase);

            // Create TestResult
            var result = new TestResult(testcase, _settings, true);

            TestResults.Add(result);
        }
예제 #29
0
        protected void DataPortal_Fetch(object criteria)
        {
            Criteria crit = (Criteria)(criteria);

            using (BypassPropertyChecks)
                Name = crit._name;
            MarkOld();
            TestResults.Add("HasRulesManager", "Fetched");
        }
예제 #30
0
 protected void DataPortal_Fetch(StronglyTypedDP.Criteria criteria)
 {
     using (BypassPropertyChecks)
     {
         Data = criteria._data;
         Id   = criteria._ID;
     }
     MarkOld();
     TestResults.Add("StronglyTypedDP", "Fetched");
 }