public string processFragment(string fragment, string csv) { usernames = csvToCollection(csv); XDocument document = new TestRig() .WithFixture(this) .ProcessFragment(fragment) .GetXDocument(); var result = String.Empty; var table = document.Descendants("table").ToList()[0]; var rows = table.Elements("tr"); for (int index = 1; index < rows.Count(); index++) { var row = rows.ToArray()[index]; if (!String.IsNullOrEmpty(result)) { result += ", "; } result += categorize(row); } return result; }
public bool fragmentSucceeds(string fragment) { ProcessingResult result = new TestRig() .WithFixture(this) .ProcessFragment(fragment); return result.IsSuccess && result.SuccessCount > 0; }
public string process(string snippet) { long successCount = new TestRig() .WithStubbedEvaluationResult("Fred") .ProcessFragment(snippet) .SuccessCount; return successCount == 1 ? snippet : "Did not work"; }
public string process(string html) { var rootElement = new TestRig() .Process(html) .GetXDocument() .Root; removeIrrelevantElements(rootElement); return rootElement.ToString(SaveOptions.DisableFormatting); }
public string process(string inputFragment) { var document = new TestRig() .WithFixture(this) .ProcessFragment(inputFragment) .GetXDocument(); var table = document.Element("html").Element("body").Element("fragment").Element("table"); return table.ToString().Replace("\u00A0", " "); }
public string process(string snippet) { ProcessingResult r = new TestRig() .WithFixture(this) .ProcessFragment(snippet); if (r.ExceptionCount != 0) { return "exception"; } return r.SuccessOrFailureInWords(); }
public object countsFromExecutingSnippetWithSimulatedEvaluationResult(string snippet, string simulatedResult) { TestRig harness = new TestRig(); if (simulatedResult.Equals("(An exception)")) { harness.WithStubbedEvaluationResult(new Exception("simulated exception")); } else { harness.WithStubbedEvaluationResult(simulatedResult); } return harness.ProcessFragment(snippet); }
public string getOutputFragment(string inputFragment) { var document = new TestRig() .WithFixture(this) .ProcessFragment(inputFragment) .GetXDocument(); var tables = document.Descendants("table"); foreach (var table in tables) { // stops loop after first entry, simulating the java code. return table.ToString().Replace("\u00A0", " "); } return String.Empty; }
public Result process(string fragment) { ProcessingResult r = new TestRig() .WithFixture(this) .ProcessFragment(fragment); Result result = new Result(); result.successCount = r.SuccessCount; result.failureCount = r.FailureCount; result.exceptionCount = r.ExceptionCount; // TODO - repair this var lastEvent = r.GetLastAssertEqualsFailureEvent(); if (lastEvent != null) { result.lastActualValue = lastEvent.Actual; result.lastExpectedValue = lastEvent.Expected; } return result; }
public void Setup(bool metadataMode, string metadataPath) { pair = new ConnectionPair(55432); rig = TestRig.CreateSingleFile(1024*1024*1024, 32768, metadataMode); rig.MetadataPath = metadataPath; rig.RecreateManager(); rig.Manager.HashChecked = true; rig.Manager.Start(); rig.AddConnection(pair.Outgoing); var connection = pair.Incoming; var id = new PeerId(new Peer("", connection.Uri), rig.Manager); id.Connection = connection; byte[] data; EncryptorFactory.EndCheckEncryption( EncryptorFactory.BeginCheckEncryption(id, 68, null, null, new[] {id.TorrentManager.InfoHash}), out data); decryptor = id.Decryptor; encryptor = id.Encryptor; }
protected override void ConfigureTestRig() { TestRig.WithResource(new org.concordion.api.Resource(ResourceExtension.SourcePath), "0101"); }
public bool isAvailable(string resourcePath) { return(TestRig.HasCopiedResource(new org.concordion.api.Resource(resourcePath))); }
private void SpawnTestRig(Vector3 startOffset, bool isFixed) { TestRig rig = new TestRig(World, startOffset, isFixed); rigs.Add(rig); }
public void FixtureSetup() { rig = TestRig.CreateMultiFile(); id = new PeerId(new Peer(new string('a', 20), new Uri("ipv4://BLAH")), rig.Manager, NullConnection.Incoming); id.BitField.SetAll(true); }
public void Setup() { Engine = new ClientEngine(); Torrent = TestRig.CreateMultiFileTorrent(new[] { new TorrentFile("path", Piece.BlockSize * 1024) }, Piece.BlockSize * 8, out torrentInfo); MagnetLink = new MagnetLink(Torrent.InfoHash, "MagnetDownload"); }
public void GlobalSetup() { _rig = TestRig.CreateMultiFile(); }
public void FixtureSetup() { string[][] trackers = new string[][] { new string [] { "custom://tracker1.com/announce", "custom://tracker2.com/announce", "custom://tracker3.com/announce", "custom://tracker4.com/announce" }, new string[] { "custom://tracker5.com/announce", "custom://tracker6.com/announce", "custom://tracker7.com/announce", "custom://tracker8.com/announce" } }; rig = TestRig.CreateTrackers(trackers); }
public async Task Setup(bool metadataMode, string metadataPath, bool multiFile = false) { pair = new ConnectionPair().WithTimeout(); rig = multiFile ? TestRig.CreateMultiFile(32768, metadataMode) : TestRig.CreateSingleFile(1024 * 1024 * 1024, 32768, metadataMode); rig.MetadataPath = metadataPath; rig.RecreateManager().Wait(); rig.Manager.HashChecked = true; await rig.Manager.StartAsync(); rig.AddConnection(pair.Outgoing); var connection = pair.Incoming; PeerId id = new PeerId(new Peer("", connection.Uri), connection, rig.Manager.Bitfield?.Clone().SetAll(false)); var result = await EncryptorFactory.CheckIncomingConnectionAsync(id.Connection, id.Peer.AllowedEncryption, rig.Engine.Settings, new[] { rig.Manager.InfoHash }); decryptor = id.Decryptor = result.Decryptor; encryptor = id.Encryptor = result.Encryptor; }
public void SingleFileTorrent() { rig.Dispose(); rig = TestRig.CreateSingleFile(); var url = rig.Torrent.GetRightHttpSeeds[0]; connection = new HttpConnection(new Uri(url)); connection.Manager = rig.Manager; id = new PeerId(new Peer("this is my id", connection.Uri), rig.Manager); id.Connection = connection; id.IsChoking = false; id.AmInterested = true; id.BitField.SetAll(true); id.MaxPendingRequests = numberOfPieces; requests = rig.Manager.PieceManager.Picker.PickPiece(id, new List<PeerId>(), numberOfPieces); RecieveFirst(); Assert.Equal(url, requestedUrl[0]); }