public void LineAtPointTest() { TPage page = m_TestPage; DataLocator target = new DataLocator(page); Point point = new Point(); TLine expected = null; TLine actual = null; IList <TLine> result = target.LinesAtPoint(point); if (result.Count > 0) { actual = result[0]; } Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.LineAtPoint did not return the expected value."); point = new Point(325, 285); expected = page.Lines[0]; actual = target.LinesAtPoint(point)[0]; Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.LineAtPoint did not return the expected value."); }
public IDeployment ReadDeployment(string id) { using (var service = DataLocator.GetPersistenceService()) { return(service.Object.Read <IDeployment>(id)); } }
public void CreateConfiguration(string id, IConfiguration configuration) { using (var service = DataLocator.GetPersistenceService()) { service.Object.Create(id, configuration); } }
public void LinesInRectangleTest() { TPage page = m_TestPage; DataLocator target = new DataLocator(page); Rectangle rectangle = new Rectangle(0, 0, 1, 1); bool containsOnly = false; // TODO: Initialize to an appropriate value IList <TLine> actual; actual = target.LinesInRectangle(rectangle, containsOnly); Assert.AreEqual(0, actual.Count, "Recognition.Locator.DataLocator.WordsInRectangle did not return the expected valu" + "e."); rectangle = page.Lines[0].Rectangle; rectangle.Offset(100, 20); actual = target.LinesInRectangle(rectangle, containsOnly); Assert.AreEqual(1, actual.Count, "Recognition.Locator.DataLocator.WordsInRectangle did not return the expected valu" + "e."); Assert.AreEqual(page.Lines[0], actual[0], "Recognition.Locator.DataLocator.WordsInRectangle did not return the expected valu" + "e."); }
public void CreateDeploymentStep(string deploymentName, IDeploymentStep deploymentStep) { using (var service = DataLocator.GetPersistenceService()) { service.Object.Create(deploymentName + " Step" + deploymentStep.Id, deploymentStep); } }
public void CreateDeployment(IDeployment deployment) { using (var service = DataLocator.GetPersistenceService()) { service.Object.Create(deployment.Name, deployment); } }
public void DeleteRelease(IRelease release) { using (var service = DataLocator.GetPersistenceService()) { service.Object.Delete(release.Version, release); } }
public IConfiguration ReadConfiguration(string id) { using (var service = DataLocator.GetPersistenceService()) { return(service.Object.Read <IConfiguration>(id)); } }
public IRelease ReadRelease(string id) { using (var service = DataLocator.GetPersistenceService()) { return(service.Object.Read <IRelease>(id)); } }
// ReSharper disable once EmptyConstructor //public AutofacContractResolver() //{ //} protected override JsonObjectContract CreateObjectContract(Type objectType) { JsonObjectContract contract = base.CreateObjectContract(objectType); // use Autofac to create types that have been registered with it contract.DefaultCreator = () => DataLocator.GetObject(objectType); return(contract); }
public void PageTest() { TPage page = m_TestPage; DataLocator target = new DataLocator(page); TPage val = m_TestPage; Assert.AreEqual(val, target.Page, "Recognition.Locator.DataLocator.Page was not set correctly."); }
public IEnumerable <string> ReadReleaseVersions() { var list = new List <string>(); using (var service = DataLocator.GetPersistenceService()) { foreach (var id in service.Object.List <IRelease>()) { list.Add(id); } } return(list.OrderBy(s => s).ToList()); }
public IList <IRelease> ReadReleases() { var list = new List <IRelease>(); using (var service = DataLocator.GetPersistenceService()) { foreach (var id in service.Object.List <IRelease>()) { var release = service.Object.Read <IRelease>(id); list.Add(release); } } return(list.OrderBy(s => s.DueDate).ToList()); }
public IList <IDeployment> ReadDeployments() { var list = new List <IDeployment>(); using (var service = DataLocator.GetPersistenceService()) { foreach (var id in service.Object.List <IDeployment>()) { var deployment = service.Object.Read <IDeployment>(id); list.Add(deployment); } } return(list.OrderBy(s => s.DueDate).ToList()); }
public void ConstructorTest() { System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew(); TPage page = TPage.LoadFromPRD("P0001.PRD"); long pageLoding = watch.ElapsedMilliseconds; DataLocator target = new DataLocator(page); long pageIndex = watch.ElapsedMilliseconds; watch.Stop(); TestContext.WriteLine("{0} load, {1} index", pageLoding, pageIndex); Recognition_Locator_DataLocatorAccessor access = new Recognition_Locator_DataLocatorAccessor(target); Assert.AreEqual(page.Lines.Count, access.m_LineWords.Count); }
public IEnumerable <IDeploymentStep> ReadDeploymentSteps(string deploymentName) { using (var service = DataLocator.GetPersistenceService()) { var list = service.Object.List <IDeploymentStep>(deploymentName).OrderBy(s => s.Id).ToList(); //Activate next Step //ToDo: create separate service for StepState control foreach (var deploymentStep in list) { if (deploymentStep.StepState == DeploymentStepState.Active) { break; } if (deploymentStep.StepState == DeploymentStepState.Init) { deploymentStep.StepState = DeploymentStepState.Active; break; } } return(list); } }
public void CharAtPointTest() { TPage page = m_TestPage; DataLocator target = new DataLocator(page); Point point = new Point(); TChar expected = null; TChar actual; actual = target.CharAtPoint(point); Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.CharAtPoint did not return the expected value."); point = new Point(325, 285); expected = page.Lines[0].Words[0].Chars[0]; actual = target.CharAtPoint(point); Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.HasLineAtPoint did not return the expected value." + ""); }
public void WordAtPointTest() { TPage page = m_TestPage; DataLocator target = new DataLocator(page); Point point = new Point(); // TODO: Initialize to an appropriate value TWord expected = null; TWord actual; actual = target.WordAtPoint(point); Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.WordAtPoint did not return the expected value."); point = new Point(325, 285); expected = page.Lines[0].Words[0]; actual = target.WordAtPoint(point); Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.HasLineAtPoint did not return the expected value." + ""); }
public void HasLineAtPointTest() { TPage page = m_TestPage; DataLocator target = new DataLocator(page); Point point = new Point(); bool expected = false; bool actual; actual = target.HasLineAtPoint(point); Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.HasLineAtPoint did not return the expected value." + ""); point = new Point(325, 285); expected = true; actual = target.HasLineAtPoint(point); Assert.AreEqual(expected, actual, "Recognition.Locator.DataLocator.HasLineAtPoint did not return the expected value." + ""); }