private TestReporter AddTestReporter(IReadonlyNode <TestReporter> parent, Path path, Location test, string tags) { TestItemType type = TestItemType.Suite; if (test.Index == path.Length - 2) { type = TestItemType.Test; } else if (test.Index == path.Length - 1) { type = TestItemType.Step; } var startTestItemRequest = new StartTestItemRequest() { Name = test.Name, StartTime = DateTime.UtcNow, Type = type, Tags = SplitOnTags(tags) }; var suite = parent.Value != null ? parent.Value.StartNewTestNode(startTestItemRequest) : _launchReporter.StartNewTestNode(startTestItemRequest); return(suite); }
public void Delete([FromODataUri] int key) { TestItemType testitemtype = db.TestItemTypes.Find(key); db.TestItemTypes.Remove(testitemtype); db.SaveChanges(); }
private ExchangeResult <TestItemType> GetExchangeResult(TestItemType type, float cost, float amount = 1) { return(new ExchangeResult <TestItemType> { amount = amount, cost = cost, type = type }); }
public TestItemType Patch([FromODataUri] int key, Delta <TestItemType> patch) { TestItemType testitemtype = db.TestItemTypes.Find(key); patch.Patch(testitemtype); db.SaveChanges(); return(testitemtype); }
public TestItemType Get([FromODataUri] int key) { TestItemType testitemtype = db.TestItemTypes.Find(key); if (testitemtype == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(testitemtype); }
// GET api/TestItemTypes/5 public TestItemType GetTestItemType(int id) { TestItemType testitemtype = db.TestItemTypes.Find(id); if (testitemtype == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(testitemtype); }
// POST api/TestItemTypes public HttpResponseMessage PostTestItemType(TestItemType testitemtype) { if (ModelState.IsValid) { db.TestItemTypes.Add(testitemtype); db.SaveChanges(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, testitemtype); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = testitemtype.Id })); return(response); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
// POST api/TestItemTypes public HttpResponseMessage PostTestItemType(TestItemType testitemtype) { if (ModelState.IsValid) { db.TestItemTypes.Add(testitemtype); db.SaveChanges(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, testitemtype); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = testitemtype.Id })); return response; } else { return Request.CreateResponse(HttpStatusCode.BadRequest); } }
private (ExchangeResult <TestItemType>, PurchaseOperationResult <TestItemType>) GetLedgerTransaction( TestItemType soldType = TestItemType.Corn, TestItemType boughtType = TestItemType.Cactus, float sellAmount = 1, float purchaseAmount = 1) { return (GetExchangeResult(soldType, 1, sellAmount) , new PurchaseOperationResult <TestItemType> { exchages = new[] { GetExchangeResult(boughtType, 1, purchaseAmount) }, utilityGained = 0.5f }); }
public async Task VerifyTypeOfTests(TestItemType type) { var test = await Service.TestItem.StartAsync(new StartTestItemRequest { LaunchUuid = _fixture.LaunchUuid, Name = "Test1", StartTime = DateTime.UtcNow, Type = type }); Assert.NotNull(test.Uuid); var message = await Service.TestItem.FinishAsync(test.Uuid, new FinishTestItemRequest { EndTime = DateTime.UtcNow, Status = Status.Passed }); Assert.Contains("successfully", message.Info); }
// DELETE api/TestItemTypes/5 public HttpResponseMessage DeleteTestItemType(int id) { TestItemType testitemtype = db.TestItemTypes.Find(id); if (testitemtype == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } db.TestItemTypes.Remove(testitemtype); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, testitemtype)); }
// PUT api/TestItemTypes/5 public HttpResponseMessage PutTestItemType(int id, TestItemType testitemtype) { if (ModelState.IsValid && id == testitemtype.Id) { db.Entry(testitemtype).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
// PUT api/TestItemTypes/5 public HttpResponseMessage PutTestItemType(int id, TestItemType testitemtype) { if (ModelState.IsValid && id == testitemtype.Id) { db.Entry(testitemtype).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return Request.CreateResponse(HttpStatusCode.NotFound); } return Request.CreateResponse(HttpStatusCode.OK); } else { return Request.CreateResponse(HttpStatusCode.BadRequest); } }
/// <summary> /// Constructor /// </summary> /// <param name="lineNr">The line number in the test script output that represents the start of this item</param> /// <param name="timeStamp">The time and data of the moment this item was started</param> /// <param name="flowLineType">Marks if the item was started, ended or aborted</param> /// <param name="testItemType">The type of the item (Loop, Test batch etc.)</param> /// <param name="identifier">The name of the item</param> /// <param name="enabled">True if the item is executed;False otherwise</param> public TafScriptFlowLine(int lineNr, string timeStamp, FlowLineType flowLineType, TestItemType testItemType, string identifier, bool enabled) : base(lineNr, timeStamp, testItemType.ToString(), identifier, enabled) { FlowLineType = flowLineType; TestItemType = testItemType; if (TestItemType == TestItemType.TestBatch || TestItemType == TestItemType.NormalTestCase) { Value = Value.Replace(".xml", ""); Value = Value.Replace(".xls", ""); } if (TestItemType != TestItemType.NormalTestCase) { return; } if (!Value.Contains("(")) { return; } // The test case identifiers also contain the type of test case. Move this to the type field i.s.o. the value field Value = $"{Value} {Value.Substring(Value.IndexOf("(", StringComparison.Ordinal))}"; Value = Value.Substring(0, Value.IndexOf("(", StringComparison.Ordinal)); }
public static TestItemBase CreateTestItem(TestItemType type, bool addEventHandler) { switch (type) { case TestItemType.RxChaSun: TestItemBase RXChaSun = new TestItemOnAV(SwitchSetting.RXChaSunZhuBo, Settings.Default.chOfRxChaSun.ToString()); RXChaSun.Pick = DataPickers.ValuePicker.PickMin; RXChaSun.Predicator = new RxChaSunPredicator(); RXChaSun.Name = "RX插损"; if (addEventHandler) { RXChaSun.DataRead += RXChaSun_DataRead; } return(RXChaSun); break; case TestItemType.TxChaSun: TestItemBase TXChaSun = new TestItemOnAV(SwitchSetting.TXChaSunZhuBo, Settings.Default.chOfTxChaSun.ToString()); TXChaSun.Pick = DataPickers.ValuePicker.PickMin; TXChaSun.Predicator = new TxChaSunPredicator(); TXChaSun.Name = "TX插损"; if (addEventHandler) { TXChaSun.DataRead += TXChaSun_DataRead; } return(TXChaSun); break; case TestItemType.TxPower: TestItemBase TXPowerResist = new TxPowerTestItem(SwitchSetting.TXPowerResist, Settings.Default.chOfTxNaiGongLu.ToString()); TXPowerResist.Pick = DataPickers.ValuePicker.PickMin; TXPowerResist.Predicator = new TxPowerPredicator(); if (addEventHandler) { TXPowerResist.DataRead += new DataReadEventHandler(TXPowerResist_DataRead); TXPowerResist.DataRead += new DataReadEventHandler(ShutDownShuanJianLast); } TXPowerResist.Name = "TX耐功率"; TXPowerResist.BeforeSetup += new EventHandler(OpenShuaiJianFirst); return(TXPowerResist); break; case TestItemType.RxGeLi: TestItemBase RXGeLiDu = new TestItemOnAV(SwitchSetting.RXGeLiDu, Settings.Default.chOfRxGeLiDu.ToString()); RXGeLiDu.Pick = DataPickers.ValuePicker.PickMin; RXGeLiDu.Predicator = new Predicators.RxGeLiPredicator(); RXGeLiDu.Name = "RX隔离度"; if (addEventHandler) { RXGeLiDu.DataRead += new DataReadEventHandler(RXGeLiDu_DataRead); } return(RXGeLiDu); break; default: throw new NotSupportedException("test item type not supprted"); } }
public TestItemType Post(TestItemType item) { db.TestItemTypes.Add(item); db.SaveChanges(); return(item); }
public TestItemType Post(TestItemType item) { db.TestItemTypes.Add(item); db.SaveChanges(); return item; }
public static TestItemBase CreateTestItem(TestItemType type, bool addEventHandler) { switch (type) { case TestItemType.RxChaSun: TestItemBase RXChaSun = new TestItemOnAV(SwitchSetting.RXChaSunZhuBo, Settings.Default.chOfRxChaSun.ToString()); RXChaSun.Pick = DataPickers.ValuePicker.PickMin; RXChaSun.Predicator = new RxChaSunPredicator(); RXChaSun.Name = "RX插损"; if (addEventHandler) { RXChaSun.DataRead += RXChaSun_DataRead; } return RXChaSun; break; case TestItemType.TxChaSun: TestItemBase TXChaSun = new TestItemOnAV(SwitchSetting.TXChaSunZhuBo, Settings.Default.chOfTxChaSun.ToString()); TXChaSun.Pick = DataPickers.ValuePicker.PickMin; TXChaSun.Predicator = new TxChaSunPredicator(); TXChaSun.Name = "TX插损"; if (addEventHandler) { TXChaSun.DataRead += TXChaSun_DataRead; } return TXChaSun; break; case TestItemType.TxPower: TestItemBase TXPowerResist = new TxPowerTestItem(SwitchSetting.TXPowerResist, Settings.Default.chOfTxNaiGongLu.ToString()); TXPowerResist.Pick = DataPickers.ValuePicker.PickMin; TXPowerResist.Predicator = new TxPowerPredicator(); if (addEventHandler) { TXPowerResist.DataRead += new DataReadEventHandler(TXPowerResist_DataRead); TXPowerResist.DataRead += new DataReadEventHandler(ShutDownShuanJianLast); } TXPowerResist.Name = "TX耐功率"; TXPowerResist.BeforeSetup += new EventHandler(OpenShuaiJianFirst); return TXPowerResist; break; case TestItemType.RxGeLi: TestItemBase RXGeLiDu = new TestItemOnAV(SwitchSetting.RXGeLiDu, Settings.Default.chOfRxGeLiDu.ToString()); RXGeLiDu.Pick = DataPickers.ValuePicker.PickMin; RXGeLiDu.Predicator = new Predicators.RxGeLiPredicator(); RXGeLiDu.Name = "RX隔离度"; if (addEventHandler) { RXGeLiDu.DataRead += new DataReadEventHandler(RXGeLiDu_DataRead); } return RXGeLiDu; break; default: throw new NotSupportedException("test item type not supprted"); } }