static void Main() { Test t = new Test(); t.SerializeCollection("coll.xml"); Console.ReadKey(true); }
public static void Main() { Foo f = new Foo(0, 1); Bar b = new Bar(0, 1, new Foo(0, 1)); Test t = new Test(); Date d = new Date("3/9/1976"); int[] items = new Array(); int[] items2 = new int[] { 1, 2 }; int[] items3 = { 4, 5 }; int[] items4 = new int[5]; ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(5); ArrayList list3 = new ArrayList("abc", "def", "ghi"); ArrayList list4 = new ArrayList(1, 2, 3); Date[] dates = new Date[] { new Date("1/1/2006"), new Date("1/1/2005") }; Point p = new Point(0, 0); CustomDictionary cd = new CustomDictionary(); CustomDictionary cd2 = new CustomDictionary("abc", 123, "def", true); object o1 = Script.CreateInstance(typeof(Test)); Type type1 = typeof(Foo); object o2 = Script.CreateInstance(type1, 1, 2); object o3 = Script.CreateInstance(typeof(Bar), 1, 2, (Foo)o2); Function f1 = new Function("alert('hello');"); Function f2 = new Function("alert(s);", "s"); Function f3 = new Function("alert(greeting + ' ' + name + '!');", "greeting", "name"); }
public void AddNewTest(ATAEntities context, int projectId, Test testToAdd) { ATADataModel.Project p = ATACore.Managers.ProjectManager.GetById(context, projectId); testToAdd.AdditionDate = DateTime.Now; p.Tests.Add(testToAdd); context.SaveChanges(); }
/// <summary> /// Creates a test node as a top-most level test /// </summary> /// /// <param name="Name">Test name</param> /// <param name="Description">A short description of the test</param> public ExtentTest(string Name, string Description) { _test = new Test(); _test.Name = Name; _test.Description = Description; }
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase) { Test.Framework.TestResult result; DDS.DomainParticipantFactory factory; DDS.DomainParticipantQos qosHolder = null; DDS.IDomainParticipant participant1; DDS.ReturnCode rc; result = new Test.Framework.TestResult("newly created DomainParticipant", "newly created DomainParticipant" , Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass); factory = DDS.DomainParticipantFactory.Instance; if (factory == null) { result.Result = "failure creating a DomainParticipantFactory"; result.Verdict = Test.Framework.TestVerdict.Fail; return result; } rc = factory.GetDefaultParticipantQos(ref qosHolder); if (rc != DDS.ReturnCode.Ok) { result.Result = "failure resolving the default participant qos (" + rc + ")."; result.Verdict = Test.Framework.TestVerdict.Fail; return result; } participant1 = factory.CreateParticipant(string.Empty, qosHolder);//, null, 0); if (participant1 == null) { result.Result = "failure creating a DomainParticipant using null as qos parameter"; result.Verdict = Test.Framework.TestVerdict.Fail; return result; } testCase.RegisterObject("theFactory", factory); testCase.RegisterObject("participant1", participant1); return result; }
private bool IgnoreTestForBrowser(Test test, MemberInfo member) { bool ignoreTest = false; Attribute[] ignoreAttr = Reflect.GetAttributes(member, IgnoreBrowserAttributeTypeFullName, true); if (member != null && ignoreAttr != null) { // A test case might be ignored in more than one browser foreach (System.Attribute attr in ignoreAttr) { object propVal = Reflect.GetPropertyValue(attr, "Value", BindingFlags.Public | BindingFlags.Instance); object reasonValue = Reflect.GetPropertyValue(attr, "Reason", BindingFlags.Public | BindingFlags.Instance); if (propVal != null) { string ignoreReason = "Ignoring browser " + EnvironmentManager.Instance.Browser.ToString() + "."; if (reasonValue != null) { ignoreReason = ignoreReason + " " + reasonValue.ToString(); } Browser browser = (Browser)propVal; if (browser.Equals(EnvironmentManager.Instance.Browser) || browser.Equals(Browser.All) || IsRemoteInstanceOfBrowser(browser)) { ignoreTest = true; } } } } return ignoreTest; }
static void Main(string[] args) { var test = new Test(); test.Start(); Console.ReadKey(); }
private void pictureBox2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { textBox1.Clear(); MessageBox.Show("Nama harus diisi", "WARNING!!!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { data dat = new data(textBox1.Text); db.OpenConn(); try { string sql = string.Concat("INSERT INTO Users " + "([nama]) VALUES " + "('"+textBox1.Text+"')"); db.execQuery(sql); //MessageBox.Show("Nama Add Sukses"); Test tst = new Test(); this.Close(); tst.Show(); data.cektestbuttonabout = false; data.cektestbuttoninfo = false; } catch (Exception) { //MessageBox.Show("Data tidak dimasukkan"); } db.CloseConn(); } }
private static int Main() { Test test = new Test(20.0d); test.Print(); Console.WriteLine("*** PASSED ***"); return 100; }
static void Main() { Test test = new Test(); test.Changed = new MyMessage(); test.No = 10; test.No = 50; }
public void SerializeToXmlDocument_TestModel_ReturnsXmlDocument() { var model = new Test { Name = "John Doe", Birth = new DateTime(1950, 1, 1) }; var document = XmlHelper.SerializeToXmlDocument(model); Assert.IsNotNull(document); Assert.AreEqual("John Doe", document.DocumentElement.FirstChild.FirstChild.Value); }
public static int Main() { Test staticsTest = new Test(); staticsTest.RunTest(); Console.WriteLine(100 == staticsTest.retVal ? "Test Passed":"Test Failed"); return staticsTest.retVal; }
public IHttpActionResult Post(Test test) { this.studentDataManagement.Tests.Add(test); this.studentDataManagement.SaveChanges(); return this.Ok("New Test added"); }
public IHttpActionResult PutTest(int id, Test test) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != test.Id) { return BadRequest(); } db.Entry(test).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TestExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
private void test_Click(object sender, EventArgs e) { this.Hide(); Test test = new Test(this); test.SetDesktopLocation(this.DesktopLocation.X, this.DesktopLocation.Y); test.Show(); }
unsafe static void Main() { Test test = new Test(); Test* p = &test; p->x = 9; System.Console.WriteLine (test.x); }
static int Main() { Test t = new Test(); t.RunTest(); return t.CheckRet(); }
Test GetAssemblyTest(IAssemblyInfo assembly, Test parentTest, Version frameworkVersion, bool populateRecursively) { MachineAssemblyTest assemblyTest; if (!assemblyTests.TryGetValue(assembly, out assemblyTest)) { assemblyTest = new MachineAssemblyTest(assembly.Name, assembly, frameworkVersion); assemblyTest.Kind = TestKinds.Assembly; ModelUtils.PopulateMetadataFromAssembly(assembly, assemblyTest.Metadata); string frameworkName = String.Format("Machine Specifications v{0}", frameworkVersion); assemblyTest.Metadata.SetValue(MetadataKeys.Framework, frameworkName); assemblyTest.Metadata.SetValue(MetadataKeys.File, assembly.Path); assemblyTest.Kind = TestKinds.Assembly; parentTest.AddChild(assemblyTest); assemblyTests.Add(assembly, assemblyTest); } if (populateRecursively) { AssemblyExplorer explorer = new AssemblyExplorer(); Assembly resolvedAssembly = assembly.Resolve(false); assemblyTest.AssemblyContexts = explorer.FindAssemblyContextsIn( resolvedAssembly).ToList(); assemblyTest.GlobalCleanup = explorer.FindAssemblyWideContextCleanupsIn(resolvedAssembly).ToList(); assemblyTest.SpecificationSupplements = explorer.FindSpecificationSupplementsIn(resolvedAssembly).ToList(); explorer.FindContextsIn(resolvedAssembly) .Select( context => GetContextTest( context)) .Each( test => assemblyTest.AddChild( test)); } return assemblyTest; }
public DataDrivenLoopOperationViewModel(Test test, IEventAggregator eventAggregator) { this.test = test; AddToTestCommand = new DelegateCommand(ExecuteAddToTestCommand); addTestItemEvent = eventAggregator.GetEvent<AddTestItemEvent>(); }
public void SetUp() { runner = new TestRunner(x => x.AddFixture<SlowFixture>()); test = new Test("slow test").With(Section.For<SlowFixture>().WithStep("GoSlow")); var reset = new ManualResetEvent(false); var running = new ManualResetEvent(false); var thread = new Thread(() => { running.Set(); Debug.WriteLine("Starting to run"); test.LastResult = runner.RunTest(new TestExecutionRequest() { Test = test, TimeoutInSeconds = 60 }); test.LastResult.ShouldNotBeNull(); Debug.WriteLine("finished running"); reset.Set(); }); thread.Start(); running.WaitOne(); Thread.Sleep(1000); Debug.WriteLine("Aborting now!"); runner.Abort(); Debug.WriteLine("Done aborting"); reset.WaitOne(5000); test.LastResult.ShouldNotBeNull(); Debug.WriteLine("completely done"); }
private static int refanyval_ldobj() { Test T = new Test(); T._m_v = 1; TypedReference R = __makeref(T); return __refvalue(R, Test)._m_v - 1; }
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase) { DDS.IDomainParticipant participant; DDS.SubscriberQos subscriberQosHolder = null; DDS.ISubscriber subscriber; Test.Framework.TestResult result; DDS.ITopic topic; participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant"); topic = (DDS.ITopic)testCase.ResolveObject("topic"); result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail); if (participant == null || topic == null) { System.Console.Error.WriteLine("participant or topic = null"); result.Result = "precondition not met"; return result; } if (participant.GetDefaultSubscriberQos(ref subscriberQosHolder) != DDS.ReturnCode.Ok) { result.Result = "could not get default SubscriberQos"; return result; } subscriber = participant.CreateSubscriber(subscriberQosHolder);//, null, DDS.StatusKind.Any); if (subscriber == null) { result.Result = "could create a Subscriber"; return result; } testCase.RegisterObject("subscriber", subscriber); result.Result = "Initialization success."; result.Verdict = Test.Framework.TestVerdict.Pass; return result; }
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase) { DDS.IDomainParticipant participant; mod.tstTypeSupport typeSupport; DDS.TopicQos topicQos; DDS.ITopic topic; DDS.ReturnCode rc; Test.Framework.TestResult result; participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant"); typeSupport = (mod.tstTypeSupport)testCase.ResolveObject("typeSupport"); topicQos = (DDS.TopicQos)testCase.ResolveObject("topicQos"); result = new Test.Framework.TestResult("Initialization 3 success", string.Empty, Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail); rc = typeSupport.RegisterType(participant, "my_other_type"); if (rc != DDS.ReturnCode.Ok) { result.Result = "Register type failed."; return result; } topic = participant.CreateTopic("my_other_topic", "my_other_type", topicQos);//, null, 0); if (topic == null) { result.Result = "Topic could not be created."; return result; } testCase.RegisterObject("otherTopic", topic); result.Result = "Initialization success."; result.Verdict = Test.Framework.TestVerdict.Pass; return result; }
public void TestClassMap() { // this test passes normally when the Test class is automapped // uncomment all or parts of the class map initialization code to test // the exceptions thrown for each non-compliant field or property if (__firstTime) { BsonClassMap.RegisterClassMap<Test>(cm => { cm.AutoMap(); // cm.MapField("literal"); // cm.MapField("readOnly"); // cm.MapField("notfound"); // cm.MapProperty("GetOnly"); // cm.MapProperty("SetOnly"); // cm.MapProperty("notfound"); // cm.MapMember(null); }); __firstTime = false; } var test = new Test("x") { SetOnly = "y" }; var bson = test.ToBson(); var rehydrated = BsonSerializer.Deserialize<Test>(bson); Assert.IsTrue(bson.SequenceEqual(rehydrated.ToBson())); }
protected void Page_Load(object sender, EventArgs e) { Test test=new Test(); DataTable table = test.Adomd(); GridView1.DataSource = table; GridView1.DataBind(); }
public ActionResult Add() { var db = MarketingDbContext.Instance; var tmp1 = new Project { Name = "tmp1" }; var tmp2 = new Functionality { Project = tmp1, Name = "tmp2" }; var tmp3 = new Test() { Name = "tmp3", Functionality = tmp2, }; var tmp4 = new Test() { Name = "tmp4", Functionality = tmp2, }; Repositories.TestRepository B = new Repositories.TestRepository(); var c = new Repositories.FunctionalityRepository(); TestController A = new TestController(B, c); return RedirectToAction("Index"); }
//**********************Test Messages*********************************** public ActionResult AddTest(int pid) { ViewData["PatientId"] = pid; populateTestNames(); var testmsg = new Test { TestDate = DateTime.UtcNow }; return View(testmsg); }
public static void Main() { Test test = new Test(); test.SetValue(3,5); int s = test.GetValue(); Console.WriteLine("<<< " + s); }
private static int Main() { Test app = new Test(); app._op1 = 0x00000000ffffffff; app._op2 = 0x00000000ffffffff; if (!app.check(0xfffffffe00000001, false)) goto fail; app._op1 = 0x0000000100000000; app._op2 = 0x00000000ffffffff; if (!app.check(0xffffffff00000000, false)) goto fail; app._op1 = 0x0000000100000000; app._op2 = 0x0000000100000000; if (!app.check(0x0000000000000000, true)) goto fail; app._op1 = 0x7fffffffffffffff; app._op2 = 0x0000000000000002; if (!app.check(0xfffffffffffffffe, false)) goto fail; app._op1 = 0x8000000000000000; app._op2 = 0x0000000000000002; if (!app.check(0x0000000000000000, true)) goto fail; app._op1 = 0x0000000000100000; app._op2 = 0x0000001000000000; if (!app.check(0x0100000000000000, false)) goto fail; Console.WriteLine("Test passed"); return 100; fail: Console.WriteLine("Test failed"); return 1; }
public void AsyncHTTPSICmd() { FileStream stream; stream = File.Create(outputFileHTTPSAsync); results = new StreamWriter(stream); System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch(); ICmd validICmd = new ICmd(TestGlobals.testServer, TestGlobals.validSerial); Test validTest = new Test(validICmd); validTest.setTestName("ValidSerial"); validTest.setExpectedResult ("200"); validTest.setType ("performance"); List<Test> tests = new List<Test>(); tests.Add(validTest); // Construct started tasks Task<double>[] tasks = new Task<double>[TestGlobals.maxReps]; for (int i = 0; i < TestGlobals.maxReps; i++) { System.Threading.Thread.Sleep(TestGlobals.delay); tasks[i] = new HTTPSCalls().runTest(validTest, HTTPOperation.GET); Console.WriteLine("Test starting:" + i.ToString()); } Console.WriteLine("------------------------------------------------------"); Console.WriteLine("All tests initialized, waiting on them to run as async"); Console.WriteLine("------------------------------------------------------"); Task.WaitAll(tasks); foreach (Task<double> nextResult in tasks) { results.WriteLine("Test Time," + nextResult.Result); } results.Close(); }
/* * Runs every test and creates a file in TestResults. */ static void Main(string[] args) { // Populate test list tests.Add(new PingTest()); tests.AddRange(GoogleVisionConnectionTests.GetTests()); tests.AddRange(GFCM_Test.GetTests()); tests.AddRange(GoogleBooksConnectionTests.GetTests()); tests.Add(new IsbnModelTest()); tests.Add(new DebugModeOffTest()); DateTime now = DateTime.Now; string dateTimeString = now.ToString("yyyy-MM-dd HH\\hmm"); List <Test> failedTests = new List <Test>(); using (StreamWriter sw = File.CreateText("temptestresults.txt")) { for (int i = 0; i < tests.Count; i++) { Test test = tests[i]; string name = test.GetType().Name; sw.WriteLine("START TEST: " + name); Console.Write("Running " + name + "(" + (i + 1) + "/" + tests.Count + ")..."); if (!test.Run(sw)) { failedTests.Add(test); Console.WriteLine("failed"); } else { Console.WriteLine("passed"); } sw.WriteLine("END TEST: " + name); if (i != tests.Count - 1) { sw.WriteLine(); } } sw.Close(); } using (StreamWriter sw = File.CreateText("TestResults" + Path.DirectorySeparatorChar + dateTimeString + " Test Results.txt")) { sw.WriteLine("--------------TEST RESULTS--------------"); sw.WriteLine(" Tests Run: " + tests.Count); sw.WriteLine(" Tests Failed: " + failedTests.Count); sw.WriteLine("----------------------------------------"); sw.WriteLine(); if (failedTests.Count > 0) { sw.WriteLine("----------------FAILURES----------------"); foreach (Test test in failedTests) { sw.WriteLine(" " + test.GetType().Name); } sw.WriteLine("----------------------------------------"); sw.WriteLine(); } sw.WriteLine("-----------------OUTPUT-----------------"); using (StreamReader sr = File.OpenText("temptestresults.txt")) { String s = ""; while ((s = sr.ReadLine()) != null) { sw.Write(" "); sw.WriteLine(s); } sr.Close(); } sw.WriteLine("----------------------------------------"); File.Delete("temptestresults.txt"); sw.Close(); } Console.ReadKey(); }
public void StartTest(Test test, Counts counts) { }
public static void Target <U>() { //dummy line to avoid warnings Test.Eval(typeof(U) != null); Interlocked.Increment(ref Test.Xcounter); }
public static PdfDocument Create(Test test) { PdfDocument document = new PdfDocument(); document.Info.Title = test.Name; PageSize size = PageSize.A4; PageOrientation orientation; // Looks stupid, but PdfSharp has its own size classes switch (test.Paper.Template) { case (PaperTemplate.Letter): size = PageSize.Letter; break; case (PaperTemplate.GovernmentLetter): size = PageSize.GovernmentLetter; break; case (PaperTemplate.Legal): size = PageSize.Legal; break; case (PaperTemplate.Ledger): size = PageSize.Ledger; break; case (PaperTemplate.A0): size = PageSize.A0; break; case (PaperTemplate.A1): size = PageSize.A1; break; case (PaperTemplate.A2): size = PageSize.A2; break; case (PaperTemplate.A3): size = PageSize.A3; break; case (PaperTemplate.A4): size = PageSize.A4; break; case (PaperTemplate.A5): size = PageSize.A5; break; } if (test.Paper.Orientation == PaperOrientation.Portrait) { orientation = PageOrientation.Portrait; } else { orientation = PageOrientation.Landscape; } if (size == PageSize.GovernmentLetter || size == PageSize.Ledger) { orientation = orientation == PageOrientation.Portrait ? PageOrientation.Landscape : PageOrientation.Portrait; } foreach (Page page in test.Pages) { PdfPage pdfPage = document.AddPage(); pdfPage.Size = size; pdfPage.Orientation = orientation; XGraphics g = XGraphics.FromPdfPage(pdfPage); page.PdfDraw(g); } PdfSecuritySettings securitySettings = document.SecuritySettings; securitySettings.DocumentSecurityLevel = PdfDocumentSecurityLevel.Encrypted128Bit; securitySettings.OwnerPassword = "******"; securitySettings.PermitAccessibilityExtractContent = false; securitySettings.PermitAnnotations = false; securitySettings.PermitAssembleDocument = false; securitySettings.PermitExtractContent = false; securitySettings.PermitFormsFill = false; securitySettings.PermitFullQualityPrint = false; securitySettings.PermitModifyDocument = false; securitySettings.PermitPrint = true; securitySettings.PermitFullQualityPrint = true; return(document); }
public static void Main() { Test t = new Test(); t.SerializeObject("OverrideElement.xml"); }
public void Should_assert_30_style_timeouts_being_set_together_with_other_timeouts() { Test.Saga <TimeoutSaga>() .ExpectTimeoutToBeSetIn <MyTimeout>() .When(saga => saga.Handle(new StartMessage())); }
public void TestFixtureSetUp() { Test.Initialize(); }
public void Create(Test test, string courseId) { _testRepository.Create(test, courseId); }
public void UnitTest_Reflection_AuditorAndFulfillerTypeNames(Test testCase, bool fullName) { CohortExtractorOptions opts = new CohortExtractorOptions(); //override switch (testCase) { case Test.Normal: opts.AuditorType = fullName ? typeof(NullAuditExtractions).FullName : typeof(NullAuditExtractions).Name; opts.RequestFulfillerType = fullName ? typeof(FromCataloguesExtractionRequestFulfiller).FullName : typeof(FromCataloguesExtractionRequestFulfiller).Name; opts.Validate(); break; case Test.NoAuditor: //no auditor is not a problem because it will just return NullAuditExtractions anyway opts.AuditorType = ""; opts.RequestFulfillerType = fullName ? typeof(FromCataloguesExtractionRequestFulfiller).FullName : typeof(FromCataloguesExtractionRequestFulfiller).Name; opts.Validate(); break; case Test.NoFulfiller: opts.AuditorType = fullName ? typeof(NullAuditExtractions).FullName : typeof(NullAuditExtractions).Name; opts.RequestFulfillerType = null; //lets use null here just to cover both "" and null //no fulfiller is a problem! var ex = Assert.Throws <Exception>(() => opts.Validate()); StringAssert.Contains("No RequestFulfillerType set on CohortExtractorOptions", ex.Message); break; default: throw new ArgumentOutOfRangeException("testCase"); } //if user has not provided the full name if (!fullName) { //if no auditor is provided if (testCase == Test.NoAuditor) { Assert.IsInstanceOf <NullAuditExtractions>(CreateAuditor(opts)); //this one gets created } else { Assert.Throws <TypeLoadException>(() => CreateAuditor(opts)); //if an invalid auditor (not full name, we expect TypeLoadException) } //if no fulfiller is provided if (testCase == Test.NoFulfiller) { Assert.IsNull(CreateRequestFulfiller(opts)); //we expect null to be returned } else { Assert.Throws <TypeLoadException>(() => CreateRequestFulfiller(opts)); //if an invalid fulfiller (not full name we expect TypeLoadException) } } else { Assert.IsNotNull(CreateAuditor(opts)); if (testCase == Test.NoFulfiller) { Assert.IsNull(CreateRequestFulfiller(opts)); //we expect null to be returned } else { Assert.IsNotNull(CreateRequestFulfiller(opts)); } } }
public TestWithSmiDTO(Test result, SubModuleItem smi = null) : base(result) { this.SmiVO = new SubModuleItemDTO(smi.Return(x => x, result.SubModuleItem)); }
void Start() { using var s = new Test(); }
public TestAdapter(Test test) { this.test = test; }
public void ProcessOrderSaga_SendProcessOrderCommand_WhenPlanOrderCommandSent() { Test.Saga <ProcessOrderSaga>() .ExpectSend <PlanOrderCommand>() .When((saga, context) => saga.Handle(new ProcessOrderCommand(), context)); }
static void Main() { /* inserted */ int _27 = 7; Test test = new Test(1); }
void IApplyToTest.ApplyToTest(Test test) { test.RequiresThread = true; base.ApplyToTest(test); }
public void SetUp() { test = new TestDummy(); test.RunState = RunState.Runnable; }
public void Should_assert_30_style_timeouts_being_set_with_the_correct_timespan() { Test.Saga <TimeoutSaga>() .ExpectTimeoutToBeSetIn <MyTimeout>((state, expiresIn) => expiresIn == TimeSpan.FromDays(1)) .When(saga => saga.Handle(new StartMessage())); }
public void FinishTest(Test test) { }
public DataTable GetDataFromDatabase() { Test a = new Test(); return(a.GetSomeData()); }
public void Should_assert_30_style_timeouts_being_set_with_the_correct_state() { Test.Saga <TimeoutSaga>() .ExpectTimeoutToBeSetIn <MyTimeout>((state, expiresIn) => state.SomeProperty == "Test") .When(saga => saga.Handle(new StartMessage())); }
public FakeWorkItem(Test test, TestExecutionContext context) : base(test) { InitializeContext(context); }
public static FakeWorkItem GetWorkItem(Test test, TestExecutionContext context) { return(new FakeWorkItem(test, context)); }
public TestMethod Build( IMethodInfo method, Test suite, IEnumerable <object> parameterValues, int autoDataStartIndex) { return(new TestMethod(method)); }
public static FakeWorkItem GetWorkItem(Test test) { return(GetWorkItem(test, new TestExecutionContext())); }
public void Visit(Test element) { Test += element.Weight; }
public static int Main() { const int Pass = 100; const int Fail = -1; s_field = 0x123456789abcdef; if (rol32(0x12345678, 16) != 0x56781234) { return(Fail); } if (rol32_1(0x12345678) != 0x2468ACF0) { return(Fail); } if (rol32_3(0x12345678) != 0x91A2B3C0) { return(Fail); } if (rol32comm(0x12345678, 16) != 0x56781234) { return(Fail); } if (rol32const() != 0x56781234) { return(Fail); } if (ror32(0x12345678, 12) != 0x67812345) { return(Fail); } if (ror32comm(0x12345678, 12) != 0x67812345) { return(Fail); } if (ror32const() != 0x67812345) { return(Fail); } if (rol64(0x123456789abcdef, 32) != 0x89abcdef01234567) { return(Fail); } if (rol64comm(0x123456789abcdef, 32) != 0x89abcdef01234567) { return(Fail); } if (rol64const() != 0x456789abcdef0123) { return(Fail); } if (ror64(0x123456789abcdef, 0) != 0x123456789abcdef) { return(Fail); } if (ror64comm(0x123456789abcdef, 0) != 0x123456789abcdef) { return(Fail); } if (ror64const() != 0x78091a2b3c4d5e6f) { return(Fail); } if (rol32_call(0x12345678, 16) != 0x56781234) { return(Fail); } if (rol32_and(0x12345678, 16) != 0x56781234) { return(Fail); } if (two_left_shifts(0x12345678, 7) != 0xfa2b3c00) { return(Fail); } if (not_rotation(0x87654321) != 0xeca9fd70) { return(Fail); } if (rol32xor(0x12345678, 16) != 0x56781234) { return(Fail); } if (ror64sfield(7) != 0xde02468acf13579b) { return(Fail); } Test test = new Test(0x123456789abcdef, 0x12345678, 0x1234); if (test.rol64field(11) != 0x1a2b3c4d5e6f7809) { return(Fail); } if (test.ror32vfield(3) != 0x2468acf) { return(Fail); } if (test.rol32ushort(25) != 0x68000024) { return(Fail); } return(Pass); }
public bool Update(Test test, List <int> quizIdList) { return(true); }
public void TestResume() { int fileSizeInKB = 100 * 1024; DMLibDataInfo sourceDataInfo = new DMLibDataInfo(string.Empty); DMLibDataHelper.AddOneFile(sourceDataInfo.RootNode, DMLibTestBase.FileName, fileSizeInKB); CancellationTokenSource tokenSource = new CancellationTokenSource(); TransferItem transferItem = null; var options = new TestExecutionOptions <DMLibDataInfo>(); options.LimitSpeed = true; var transferContext = new TransferContext(); var progressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 0, 1, 0, fileSizeInKB * 1024); transferContext.ProgressHandler = progressChecker.GetProgressHandler(); options.TransferItemModifier = (fileName, item) => { item.CancellationToken = tokenSource.Token; item.TransferContext = transferContext; transferItem = item; }; TransferCheckpoint firstCheckpoint = null, secondCheckpoint = null; options.AfterAllItemAdded = () => { // Wait until there are data transferred progressChecker.DataTransferred.WaitOne(); // Store the first checkpoint firstCheckpoint = transferContext.LastCheckpoint; // Cancel the transfer and store the second checkpoint tokenSource.Cancel(); }; // Cancel and store checkpoint for resume var result = this.ExecuteTestCase(sourceDataInfo, options); secondCheckpoint = transferContext.LastCheckpoint; Test.Assert(result.Exceptions.Count == 1, "Verify job is cancelled"); Exception exception = result.Exceptions[0]; VerificationHelper.VerifyExceptionErrorMessage(exception, "A task was canceled."); TransferCheckpoint firstResumeCheckpoint = null, secondResumeCheckpoint = null; ProgressChecker firstProgressChecker = null, secondProgressChecker = null; // DMLib doesn't support to resume transfer from a checkpoint which is inconsistent with // the actual transfer progress when the destination is an append blob. if (Helper.RandomBoolean() && (DMLibTestContext.DestType != DMLibDataType.AppendBlob || DMLibTestContext.IsAsync)) { Test.Info("Resume with the first checkpoint first."); firstResumeCheckpoint = firstCheckpoint; secondResumeCheckpoint = secondCheckpoint; } else { Test.Info("Resume with the second checkpoint first."); firstResumeCheckpoint = secondCheckpoint; secondResumeCheckpoint = firstCheckpoint; } // first progress checker if (DMLibTestContext.SourceType == DMLibDataType.Stream && DMLibTestContext.DestType != DMLibDataType.BlockBlob) { // The destination is already created, will cause a transfer skip firstProgressChecker = new ProgressChecker(2, fileSizeInKB * 1024, 0, 1 /* failed */, 1 /* skipped */, fileSizeInKB * 1024); } else if (DMLibTestContext.DestType == DMLibDataType.Stream || (DMLibTestContext.SourceType == DMLibDataType.Stream && DMLibTestContext.DestType == DMLibDataType.BlockBlob)) { firstProgressChecker = new ProgressChecker(2, 2 * fileSizeInKB * 1024, 1 /* transferred */, 1 /* failed */, 0, 2 * fileSizeInKB * 1024); } else { firstProgressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 1, 0, 0, fileSizeInKB * 1024); } // second progress checker if (DMLibTestContext.SourceType == DMLibDataType.Stream) { // The destination is already created, will cause a transfer skip secondProgressChecker = new ProgressChecker(2, fileSizeInKB * 1024, 0, 1 /* failed */, 1 /* skipped */, fileSizeInKB * 1024); } else if (DMLibTestContext.DestType == DMLibDataType.Stream) { secondProgressChecker = new ProgressChecker(2, 2 * fileSizeInKB * 1024, 1 /* transferred */, 1 /* failed */, 0, 2 * fileSizeInKB * 1024); } else if (DMLibTestContext.DestType == DMLibDataType.AppendBlob && !DMLibTestContext.IsAsync) { secondProgressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 0, 1 /* failed */, 0, fileSizeInKB * 1024); } else { secondProgressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 1 /* transferred */, 0, 0, fileSizeInKB * 1024); } // resume with firstResumeCheckpoint TransferItem resumeItem = transferItem.Clone(); TransferContext resumeContext = new TransferContext( IsStreamDirection() ? firstResumeCheckpoint : DMLibTestHelper.RandomReloadCheckpoint(firstResumeCheckpoint)) { ProgressHandler = firstProgressChecker.GetProgressHandler() }; resumeItem.TransferContext = resumeContext; result = this.RunTransferItems(new List <TransferItem>() { resumeItem }, new TestExecutionOptions <DMLibDataInfo>()); if (DMLibTestContext.SourceType == DMLibDataType.Stream && DMLibTestContext.DestType != DMLibDataType.BlockBlob) { Test.Assert(result.Exceptions.Count == 1, "Verify transfer is skipped when source is stream."); exception = result.Exceptions[0]; VerificationHelper.VerifyTransferException(result.Exceptions[0], TransferErrorCode.NotOverwriteExistingDestination, "Skiped file"); } else { // For sync copy, recalculate md5 of destination by downloading the file to local. if (IsCloudService(DMLibTestContext.DestType) && !DMLibTestContext.IsAsync) { DMLibDataHelper.SetCalculatedFileMD5(result.DataInfo, DestAdaptor); } VerificationHelper.VerifySingleObjectResumeResult(result, sourceDataInfo); } // resume with secondResumeCheckpoint resumeItem = transferItem.Clone(); resumeContext = new TransferContext( IsStreamDirection() ? secondResumeCheckpoint : DMLibTestHelper.RandomReloadCheckpoint(secondResumeCheckpoint)) { ProgressHandler = secondProgressChecker.GetProgressHandler() }; resumeItem.TransferContext = resumeContext; result = this.RunTransferItems(new List <TransferItem>() { resumeItem }, new TestExecutionOptions <DMLibDataInfo>()); if (DMLibTestContext.SourceType == DMLibDataType.Stream) { Test.Assert(result.Exceptions.Count == 1, "Verify transfer is skipped when source is stream."); exception = result.Exceptions[0]; VerificationHelper.VerifyTransferException(result.Exceptions[0], TransferErrorCode.NotOverwriteExistingDestination, "Skiped file"); } else if (DMLibTestContext.DestType == DMLibDataType.AppendBlob && !DMLibTestContext.IsAsync) { Test.Assert(result.Exceptions.Count == 1, "Verify reumse fails when checkpoint is inconsistent with the actual progress when destination is append blob."); exception = result.Exceptions[0]; Test.Assert(exception is InvalidOperationException, "Verify reumse fails when checkpoint is inconsistent with the actual progress when destination is append blob."); VerificationHelper.VerifyExceptionErrorMessage(exception, "Destination might be changed by other process or application."); } else { // For sync copy, recalculate md5 of destination by downloading the file to local. if (IsCloudService(DMLibTestContext.DestType) && !DMLibTestContext.IsAsync) { DMLibDataHelper.SetCalculatedFileMD5(result.DataInfo, DestAdaptor); } VerificationHelper.VerifySingleObjectResumeResult(result, sourceDataInfo); } }
public void Update(Test test) { _testRepository.Update(test); }
public static void IsRunnable(Test test) { Assert.AreEqual(RunState.Runnable, test.RunState); }