[TestInitialize] //初始化测试用例 public void MyTestInitialize() { m_Index = 0; m_Name = "GSMCodingScheme"; m_Context = new Context(); m_Case = new CodingSchemeCase(); IACell cell = Mock.CreatGsmCell(); group = Mock.MockGSMPredicGroup(); TrueFalseMatrix tFMatrix = new TrueFalseMatrix(4, 4, 0, 200, 50, true); LinkLossAssist.Init(); IProjectManager projectMgr = ServiceHelper.Lookup<MockIProjectManager>(ProjectSingleton.CurrentProject.AppContext); string absolutePath1 = ResultFilePath.CreateFilePath(projectMgr.CurrentProjectLossPath, group.Name, group.Region.Name, GSMPredictionStudyType.BestServer.ToString()); string relativePath1 = ResultFilePath.CreateRelativePath(group.Name, group.Region.Name, GSMPredictionStudyType.BestServer.ToString()); ShortResultStruct srs1 = ShortResultStruct.DefaultMax; gsmBestServerID = ValueMatrixAssist.GenerateByTrueFalseMatrix(tFMatrix, absolutePath1, relativePath1, srs1); gsmBestServerID[0] = cell.ID; string absolutePath2 = ResultFilePath.CreateFilePath(projectMgr.CurrentProjectLossPath, group.Name, group.Region.Name, GSMPredictionStudyType.DLServiceCIR.ToString()); string relativePath2 = ResultFilePath.CreateRelativePath(group.Name, group.Region.Name, GSMPredictionStudyType.DLServiceCIR.ToString()); ShortResultStruct srs2 = ShortResultStruct.DefaultMin; ValueMatrixShort gsmDLServiceCIR = ValueMatrixAssist.GenerateByTrueFalseMatrix(tFMatrix, absolutePath2, relativePath2, srs2); gsmDLServiceCIR[0] = 26 * 100; //ITrafficForApplication trafficForApplication=new MockITrafficForApplication(); m_Context.Add(ContextKeys.Group, group); m_Context.Add(ContextKeys.TFMatrix, tFMatrix); m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext); m_Context.Add(ContextKeys.GSMBestServerID, gsmBestServerID); m_Context.Add(ContextKeys.GSMDLServiceCIR, gsmDLServiceCIR); }
public void SetValuesOnDefaulAndConcurrentCtxObjs() { Logger logger = new Logger(); BizUnit bizUnit = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml"); Context ctx = new Context(bizUnit, logger); ctx.Add("Ctx1-Val1", 1); Logger concurrentLogger = new Logger(); Context ctxConcurrent = ctx.CloneForConcurrentUse(concurrentLogger); ctxConcurrent.Add("Ctx2-Val1", 24); ctx.Add("Ctx1-Val2", 2); ctxConcurrent.Add("Ctx2-Val2", 25); Assert.AreEqual((int)ctx.GetObject("Ctx1-Val1"), 1); Assert.AreEqual((int)ctx.GetObject("Ctx1-Val2"), 2); Assert.AreEqual((int)ctx.GetObject("Ctx2-Val1"), 24); Assert.AreEqual((int)ctx.GetObject("Ctx2-Val2"), 25); Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val1"), 1); Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val2"), 2); Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val1"), 24); Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx2-Val2"), 25); }
private void CreateContext() { context = new Context(); matrix = GenerateTestInterMatrix.GetInterMatrix(); context.Add(ContextKeys.UmtsHSDPAPeakThrough, matrix); List<IACell> cellList = new List<IACell>(); MockUMTSCellList.InitCellList(cellList); context.Add(ContextKeys.CellList, cellList); }
private void CreateContext() { context = new Context(); matrix = GenerateTestShortMatrix.GetShortMatrix(); context.Add(ContextKeys.UmtsEPDSCHEcNt, matrix); List<IACell> cellList = new List<IACell>(); MockUMTSCellList.InitCellList(cellList); context.Add(ContextKeys.CellList, cellList); }
private void CreatContext() { m_Context = new Context(); matrix = GenerateTestShortMatrix.GetShortMatrix(); m_Context.Add(ContextKeys.GSMBestServerID, matrix); IACell cell = Mock.CreatGsmCell(); List<IACell> cellList = new List<IACell>(); cellList.Add(cell); m_Context.Add(ContextKeys.CellList, cellList); }
private void CreatContext() { context = new Context(); matrix = GenerateTestShortMatrix.GetShortMatrix(); context.Add(ContextKeys.TDBestServerCellID, matrix); IACell cell = MockGroupAndCell.CreateTDCell(); List<IACell> cellList = new List<IACell>(); cellList.Add(cell); context.Add(ContextKeys.CellList, cellList); }
[TestInitialize] //初始化测试用例 public void MyTestInitialize() { m_Index = 0; m_Name = "CoverageArea"; m_Context = new Context(); m_Case = new CoverageAreaCase(); group = Mock.MockGSMPredicGroup(); TrueFalseMatrix tFMatrix = new TrueFalseMatrix(4, 4, 0, 200, 50, true); IACell cell = Mock.CreatGsmCell(); cellList = new List<IACell>(); double[] x = new double[1] { 100 }; double[] y = new double[1] { 100 }; cellList.Add(cell); cellList = MockCellList.CreateCellList(cellList, x, y); cellList[0].Parent.ID = 1; LinkLossAssist.Init(); IProjectManager projectMgr = ServiceHelper.Lookup<MockIProjectManager>(ProjectSingleton.CurrentProject.AppContext); string absolutePath2 = ResultFilePath.CreateFilePath(projectMgr.CurrentProjectLossPath, group.Name, group.Region.Name, GSMPredictionStudyType.BestServer.ToString()); string relativePath2 = ResultFilePath.CreateRelativePath(group.Name, group.Region.Name, GSMPredictionStudyType.BestServer.ToString()); ShortResultStruct srs2 = ShortResultStruct.DefaultMax; m_GSMBestServerID = ValueMatrixAssist.GenerateByTrueFalseMatrix(tFMatrix, absolutePath2, relativePath2, srs2); m_GSMBestServerID[m_Index] = cellList[0].ID; string absolutePath = ResultFilePath.CreateFilePath(projectMgr.CurrentProjectLossPath, group.Name, group.Region.Name, GSMPredictionStudyType.DLServiceCIR.ToString()); string relativePath = ResultFilePath.CreateRelativePath(group.Name, group.Region.Name, GSMPredictionStudyType.DLServiceCIR.ToString()); ShortResultStruct srs = ShortResultStruct.DefaultMin; m_GSMDLServiceCIR = ValueMatrixAssist.GenerateByTrueFalseMatrix(tFMatrix, absolutePath, relativePath, srs); m_GSMDLServiceCIR[m_Index] = 18 * 100; string absolutePath1 = ResultFilePath.CreateFilePath(projectMgr.CurrentProjectLossPath, group.Name, group.Region.Name, GSMPredictionStudyType.CodingScheme.ToString()); string relativePath1 = ResultFilePath.CreateRelativePath(group.Name, group.Region.Name, GSMPredictionStudyType.CodingScheme.ToString()); ShortResultStruct srs1 = ShortResultStruct.DefaultMin; m_CodingScheme = ValueMatrixAssist.GenerateByTrueFalseMatrix(tFMatrix, absolutePath1, relativePath1, srs1); m_CodingScheme[0] = 4; m_CodingScheme[11] = 11; m_Context.Add(ContextKeys.CellList, cellList); m_Context.Add(ContextKeys.CurrentCalcCell, cellList[0]); m_Context.Add(ContextKeys.Group, group); m_Context.Add(ContextKeys.TFMatrix, tFMatrix); m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext); m_Context.Add(ContextKeys.GSMBestServerID, m_GSMBestServerID); m_Context.Add(ContextKeys.GSMDLServiceCIR, m_GSMDLServiceCIR); m_Context.Add(ContextKeys.CodingScheme, m_CodingScheme); }
public void Create_FileCreateStep_TakeFromCtx() { Context ctx = new Context(); ctx.Add("PathToWriteFileTo", @"..\..\..\Test\BizUnit.Tests\Out\Data_%Guid%.xml"); TestStepBuilder tsb = new TestStepBuilder("BizUnit.FileCreateStep", null); object[] args = new object[1]; args[0] = @"..\..\..\Test\BizUnit.Tests\Data\LoadGenScript001.xml"; tsb.SetProperty("SourcePath", args); args = new object[1]; args[0] = "takeFromCtx:PathToWriteFileTo"; tsb.SetProperty("CreationPath", args); string testDirectory = @"..\..\..\Test\BizUnit.Tests\Out"; FileHelper.EmptyDirectory(testDirectory, "*.xml"); Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 0); BizUnitTestCase testCase = new BizUnitTestCase("Create_FileCreateStep_TakeFromCtx"); // Add the test step builder to the test case... testCase.AddTestStep(tsb, TestStage.Execution); BizUnit bizUnit = new BizUnit(testCase, ctx); bizUnit.RunTest(); Assert.AreEqual(FileHelper.NumberOfFilesInDirectory(testDirectory, "*.xml"), 1); }
/// <summary> /// 初始化UpPCH RSCP指标的计算 /// </summary> /// <param name="context"></param> public void InitialCase(Context context) { GetValueFromContext(context); InitData(m_tdPredicGroup, m_tFMatrix); context.Add(ContextKeys.UpPCHRSCP, m_UpPCHRSCPMatrix); }
/// <summary> /// 读取Context数据,初始化Case /// </summary> /// <param name="context"></param> public void InitialCase(Context context) { GetDataFromContext(context); InitialData(m_Group, m_TFMatrix); context.Add(ContextKeys.GSMHandOver, m_HandOver); linkLossCalc = new CoLinkLossCalc(m_Group.RxSensitivity, m_Group.TrafficTerminal, m_Group.TrafficService, m_Group.Shadow, m_Group.IndoorCoverage, m_Group.CoverageProb); }
public void MyTestInitialize() { m_Index = 0; m_Name = "BestServer"; m_Context = new Context(); m_Case = new BestServerCase(); TrueFalseMatrix matrix = new TrueFalseMatrix(4, 4, 0.0, 200, 50, true); TDPredictionGroup group = MockGroupAndCell.MockTDPredicGroup(); IACell cell = MockGroupAndCell.CreateTDCell(); LinkLossAssist.Init(); m_Context.Add(ContextKeys.CurrentCalcCell, cell); m_Context.Add(ContextKeys.Group, group); m_Context.Add(ContextKeys.TFMatrix, matrix); m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext); }
private void InitialCellList(Context context) { if (!context.ContainsKey(ContextKeys.CellList)) { List<IACell> cellList = GetCellList(context); context.Add(ContextKeys.CellList, cellList); } }
/// <summary> /// 向context中添加本case计算的指标 /// </summary> /// <param name="context"></param> private void AddStudyIntoContext(Context context) { ShortResultStruct srs = ShortResultStruct.DefaultMin; string absolutePath = ResultFilePath.CreateFilePath(m_ProjectManager.CurrentProjectLossPath, m_predictionGroup.Name, m_predictionGroup.Region.Name, TDPredictionStudyType.UL_DCH_SINR.ToString()); string relativePath = ResultFilePath.CreateRelativePath(m_predictionGroup.Name, m_predictionGroup.Region.Name, TDPredictionStudyType.UL_DCH_SINR.ToString()); m_ULDCHSINRMatrix = ValueMatrixAssist.GenerateByTrueFalseMatrix(m_tFMatrix,absolutePath,relativePath, srs); ShortResultStruct srs2 = ShortResultStruct.DefaultMin; string absolutePath2 = ResultFilePath.CreateFilePath(m_ProjectManager.CurrentProjectLossPath, m_predictionGroup.Name, m_predictionGroup.Region.Name, ContextKeys.ULDCHCIR); string relativePath2 = ResultFilePath.CreateRelativePath(m_predictionGroup.Name, m_predictionGroup.Region.Name, ContextKeys.ULDCHCIR); m_ULDCHCIRMatrix = ValueMatrixAssist.GenerateByTrueFalseMatrix(m_tFMatrix, absolutePath2, relativePath2, srs2); context.Add(ContextKeys.ULDCHSINR, m_ULDCHSINRMatrix); context.Add(ContextKeys.ULDCHCIR, m_ULDCHCIRMatrix); }
public void Initial() { binSuite = new BinSuite(); tfMatrix = new TrueFalseMatrix(10, 10, 0.0, 10.0, 1, true); tranceiverList = new List<Transceiver>(); context = new Context(); Transceiver tran1 = new Transceiver(); Transceiver tran2 = new Transceiver(); IACell cell1 = new MockCell(); IACell cell2 = new MockCell(); tran1.Cells.Add(cell1); tran2.Cells.Add(cell2); tranceiverList.Add(tran1); tranceiverList.Add(tran2); context.Add(ContextKeys.TFMatrix, tfMatrix); context.Add(ContextKeys.TranceiverList, tranceiverList); }
public void ReplaceValueOnConcurrentCtxObjs() { Logger logger = new Logger(); BizUnit bizUnit = new BizUnit(@"..\..\..\Test\BizUnit.Tests\Data\ConcurrentCtxTest001.xml"); Context ctx = new Context(bizUnit, logger); ctx.Add("Ctx1-Val1", 1); Logger concurrentLogger = new Logger(); Context ctxConcurrent = ctx.CloneForConcurrentUse(concurrentLogger); ctxConcurrent.Add("Ctx1-Val1", 2, true); ctx.Add("Ctx1-Val1", 3, true); ctxConcurrent.Add("Ctx1-Val1", 4, true); Assert.AreEqual((int)ctx.GetObject("Ctx1-Val1"), 4); Assert.AreEqual((int)ctxConcurrent.GetObject("Ctx1-Val1"), 4); }
public void Initial() { cellCase = new MockCellCase(); context = new Context(); tfMatrix = new TrueFalseMatrix(20,20,10.0,30.0,1,true); context.Add(ContextKeys.TFMatrix, tfMatrix); cell = new MockCell(); tran = new Transceiver(); Site site = new Site(); site.X = 10.0f; site.Y = 30.0f; tran.setParent(site); cell.Parent = tran; tran.addCarrier(cell); PropModelConfig config = new PropModelConfig(); config.CalcRadius = 10; cell.PropModels.Add(config); context.Add(ContextKeys.CurrentCalcCell, cell); }
public void MyTestInitialize() { m_Case = new BestServerCase(); m_Context = new Context(); TrueFalseMatrix matrix = new TrueFalseMatrix(4, 4, 0.0, 200, 50, true); m_cellList = new List<IACell>(); for (int i = 0; i < 3; i++) { IACell cell = new UMTSCell(); m_cellList.Add(cell); } double[] x = new double[3] { 50, 100, 150 }; double[] y = new double[3] { 50, 100, 50 }; MockCellList.CreateCellList(m_cellList, x, y); m_pg = new UMTSPredictionGroup(); m_pg.Region = MockRegion.CreateRegion(); m_pg.Region.Name = "region1"; m_pg.Name = "UMTSPredictionGroup1"; UnionCsService service = new UnionCsService(); Service umtsService = new UMTSService(); service.CSServiceDic.Add(NetWorkType.UMTS, umtsService); m_pg.CsService = service; m_pg.TrafficTerminal = new Terminal(); m_pg.TrafficTerminal.NetTerminalList.Add(new NetworkTerminal()); m_index = 0; LinkLossAssist.Init(); m_Context.Add(ContextKeys.Group, m_pg); m_Context.Add(ContextKeys.TFMatrix, matrix); m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext); m_Case.InitialCase(m_Context); for (int i = 0; i < 3; i++) { m_Context.Add(ContextKeys.CurrentCalcCell, m_cellList[i]); m_Case.Run(m_index, m_Context); m_Context.Remove(ContextKeys.CurrentCalcCell); } }
private CalculatorAssistant GetCalculatorAssistant(Context context) { object calculatorAssistant = null; if (!context.TryGetValue(ContextKeys.CalculatorAssistant,out calculatorAssistant)) { calculatorAssistant = new CalculatorAssistant(); context.Add(ContextKeys.CalculatorAssistant, calculatorAssistant); } return (CalculatorAssistant)calculatorAssistant; }
public void MyTestInitialize() { m_Context = new Context(); m_Name = "CellToCellInterf"; m_Case = new CellToCellInterfCase(); LinkLossAssist.Init(); //ValueMatrixShort BestServerMatrix = new ValueMatrixShort(); TrueFalseMatrix tfMatrix = new TrueFalseMatrix(4, 4, 0.0, 200, 50, true); TDPredictionGroup group = MockGroupAndCell.MockTDPredicGroup(); IACell cell = MockGroupAndCell.CreateTDCell(); ((TDSCDMACarrier)cell).SwitchPoint = 1; List<IACell> cellList = new List<IACell>(); group.tdUIParam.CurrentTimeSlot = 2; double[] x = { 100, 150 }; double[] y = { 100, 100 }; cellList.Add(new TDSCDMACarrier()); cellList.Add(new UMTSCell()); cellList = MockCellList.CreateCellList(cellList, x, y); cellList.Add(cell); ValueMatrixShort BestServerMatrix = GenerateBestServerMatrix(tfMatrix, group); InitCellList(cell, cellList); BestServerMatrix[0] = (short)(cell.ID - 2); m_Context.Add(ContextKeys.Group,group); m_Context.Add(ContextKeys.TFMatrix,tfMatrix); m_Context.Add(ContextKeys.TDBestServerCellID,BestServerMatrix); m_Context.Add(ContextKeys.CellList,cellList); m_Context.Add(ContextKeys.CurrentCalcCell,cell); m_Context.Add(ContextKeys.ApplicationContext,ProjectSingleton.CurrentProject.AppContext); }
public void MyTestInitialize() { m_Index = 0; m_Name = "HSPDSCHRSCP"; m_Case = new HSPDSCHRSCPCase(); m_Context = new Context(); tfMatrix = new TrueFalseMatrix(4, 4, 0.0, 200, 50, true); tdGroup = MockGroupAndCell.MockTDPredicGroup(); cell = MockGroupAndCell.CreateTDCell(); InitTerminal(tdGroup); LinkLossAssist.Init(); IProjectManager projectMgr = ServiceHelper.Lookup<IProjectManager>(ProjectSingleton.CurrentProject.AppContext); string path = projectMgr.CurrentProjectLossPath; string absolutePath = ResultFilePath.CreateFilePath(path, tdGroup.Name, tdGroup.Region.Name, TDPredictionStudyType.Best_Server.ToString()); string relativePath = ResultFilePath.CreateRelativePath(tdGroup.Name, tdGroup.Region.Name, TDPredictionStudyType.Best_Server.ToString()); BestServerCellID = ValueMatrixAssist.GenerateByTrueFalseMatrix(tfMatrix, absolutePath, relativePath, ShortResultStruct.DefaultMax); BestServerCellID[0] = cell.ID; m_Context.Add(ContextKeys.CurrentCalcCell, cell); m_Context.Add(ContextKeys.Group, tdGroup); m_Context.Add(ContextKeys.TDBestServerCellID, BestServerCellID); m_Context.Add(ContextKeys.TFMatrix, tfMatrix); m_Context.Add(ContextKeys.CellList, InitCellList(cell)); m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext); }
public void MyTestInitialize() { m_index = 0; m_Name = "BestServer"; m_Context = new Context(); m_case = new BestServerCase(); m_study1 = new MockStudy(); m_study2 = new MockStudy(); m_study1.Name = "BestServer"; m_study2.Name = "Handover_Area"; TrueFalseMatrix tfMatrix = new TrueFalseMatrix(4, 4, 0.0, 200, 50, true); TDPredictionGroup group = MockGroupAndCell.MockTDPredicGroup(); IACell cell = MockGroupAndCell.CreateTDCell(); LinkLossAssist.Init(); group.StudyList.Add(m_study1); group.StudyList.Add(m_study2); m_Context.Add(ContextKeys.CurrentCalcCell, cell); m_Context.Add(ContextKeys.Group, group); m_Context.Add(ContextKeys.TFMatrix, tfMatrix); m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext); }
public override void Process(IResponse response, Context context) { if (response.GetStatusCode() == 200) { if (!string.IsNullOrEmpty(response.GetResponseText())) { JObject obj = JObject.Parse(response.GetResponseText()); string value = obj[column].ToString(); LOG.DebugFormat("Adding to context: {0}={1}", GetVariableName(), value); context.Add(GetVariableName(), value); } } }
/// <summary> /// IContextLoaderStep.ExecuteContextLoader() implementation /// </summary> /// <param name="data">The data which the values are read from.</param> /// <param name="contextConfig">The configuration for the context loader test step.</param> /// <param name="context">The context object into which the values will be written.</param> public void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context) { XmlNodeList xpressions = contextConfig.SelectNodes("RegEx"); var sr = new StreamReader(data); string input = sr.ReadToEnd(); foreach(XmlNode xpression in xpressions) { XmlNode key = xpression.SelectSingleNode("@contextKey"); Match match = Regex.Match(input, xpression.InnerText); context.Add(key.InnerText, match.Value); context.LogInfo("Loading context key: \"{0}\", value: \"{1}\"", key.InnerText, match.Value); } }
public void Initial() { cellSuite = new CellSuite(); context = new Context(); tranceiverList = new List<Transceiver>(); Transceiver tran1 = new Transceiver(); Transceiver tran2 = new Transceiver(); IACell cell1 = new MockCell(); IACell cell2 = new MockCell(); tran1.Cells.Add(cell1); tran2.Cells.Add(cell2); tranceiverList.Add(tran1); tranceiverList.Add(tran2); context.Add(ContextKeys.TranceiverList, tranceiverList); }
/// <summary> /// ITestStep.Execute() implementation /// </summary> /// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param> /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param> public void Execute(XmlNode testConfig, Context context) { string filePath = context.ReadConfigAsString(testConfig, "FilePath"); string contextPropertyName = context.ReadConfigAsString(testConfig, "ContextPropertyName"); double timeOut = context.ReadConfigAsDouble(testConfig, "TimeOut", true); context.LogInfo("About to load the context property: {0} with the contents of the file: (1)", contextPropertyName, filePath); // Read the FILE from disc... MemoryStream ms = StreamHelper.LoadFileToStream(filePath, timeOut); ms.Seek(0, SeekOrigin.Begin); var sr = new StreamReader(ms); string fileData = sr.ReadToEnd(); // Write FILE contents to the context... context.Add(contextPropertyName, fileData); }
public void Can_use_computed_columns_with_null_values() { var serviceProvider = new ServiceCollection() .AddEntityFrameworkSqlServer() .BuildServiceProvider(); using (var context = new Context(serviceProvider, "ComputedColumns")) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var entity = context.Add(new Entity { P1 = 20, P2 = 30 }).Entity; context.SaveChanges(); Assert.Equal(50, entity.P4); Assert.Null(entity.P5); } }
/// <summary> /// ITestStep.Execute() implementation /// </summary> /// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param> /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param> public void Execute(XmlNode testConfig, Context context) { XmlNodeList ctxItems = testConfig.SelectNodes( "ContextItem" ); foreach (XmlNode ctxItem in ctxItems) { string newCtxNode = ctxItem.SelectSingleNode( "@contextKey" ).Value; string newValue = ""; XmlNodeList items = ctxItem.SelectNodes("ItemTest"); foreach (XmlNode item in items) { newValue += context.ReadConfigAsString(item, "."); } context.Add( newCtxNode, newValue ); } }
public override void Process(IResponse response, Context context) { if (response.GetStatusCode() == 200) { JArray array = JArray.Parse(response.GetResponseText()); string value = null; if (column.Equals("{ROWNUM}")) { value = getRowNumber(array.Count, context).ToString(); } else { value = array[getRowNumber(array.Count, context)][column].ToString(); } LOG.DebugFormat("Adding to context: {0}={1}", GetVariableName(), value); context.Add(GetVariableName(), value); } }
[TestInitialize] //初始化测试用例 public void MyTestInitialize() { m_Index = 0; m_Name = "GSMHandOver"; m_Context = new Context(); m_Case = new HandOverCase(); GSMPredicGroup m_group = Mock.MockGSMPredicGroup(); TrueFalseMatrix m_tFMatrix = new TrueFalseMatrix(4, 4, 0, 200, 50, true); IACell cell1 = Mock.CreatGsmCell(); IACell cell2 = Mock.CreatGsmCell(); cellList = new List<IACell>(); double[] x = new double[2] { 100, 150 }; double[] y = new double[2] { 100, 150 }; cellList.Add(cell1); cellList.Add(cell2); cellList =MockCellList.CreateCellList(cellList, x, y); cellList[1].Parent.ID = 1; LinkLossAssist.Init(); IProjectManager projectMgr = ServiceHelper.Lookup<MockIProjectManager>(ProjectSingleton.CurrentProject.AppContext); string absolutePath1 = ResultFilePath.CreateFilePath(projectMgr.CurrentProjectLossPath, m_group.Name, m_group.Region.Name, GSMPredictionStudyType.BCCHRP.ToString()); string relativePath1 = ResultFilePath.CreateRelativePath(m_group.Name, m_group.Region.Name, GSMPredictionStudyType.BCCHRP.ToString()); string absolutePath2 = ResultFilePath.CreateFilePath(projectMgr.CurrentProjectLossPath, m_group.Name, m_group.Region.Name, GSMPredictionStudyType.BestServer.ToString()); string relativePath2 = ResultFilePath.CreateRelativePath(m_group.Name, m_group.Region.Name, GSMPredictionStudyType.BestServer.ToString()); ShortResultStruct srs1 = ShortResultStruct.DefaultMin; ShortResultStruct srs2 = ShortResultStruct.DefaultMax; m_GSMBCCHRP = ValueMatrixAssist.GenerateByTrueFalseMatrix(m_tFMatrix, absolutePath1, relativePath1, srs1); m_GSMBestServerID = ValueMatrixAssist.GenerateByTrueFalseMatrix(m_tFMatrix, absolutePath2, relativePath2, srs2); m_GSMBestServerID[0] = cellList[0].ID; m_GSMBCCHRP[0] = 46*100; m_Context.Add(ContextKeys.Group, m_group); m_Context.Add(ContextKeys.TFMatrix, m_tFMatrix); m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext); m_Context.Add(ContextKeys.CellList, cellList); m_Context.Add(ContextKeys.CurrentCalcCell, cellList[1]); m_Context.Add(ContextKeys.GSMBCCHRP, m_GSMBCCHRP); m_Context.Add(ContextKeys.GSMBestServerID, m_GSMBestServerID); }
/// <summary> /// Execute() implementation /// </summary> /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param> public override void Execute(Context context) { FileStream dstFs = null; Stream srcFs = null; try { context.LogInfo("FileCreateStep about to copy the data from datasource to: {0}", CreationPath); srcFs = DataSource.Load(context); dstFs = System.IO.File.Create(CreationPath); var buff = new byte[BuffSize]; int read = srcFs.Read(buff, 0, BuffSize); while (read > 0) { dstFs.Write(buff, 0, read); read = srcFs.Read(buff, 0, BuffSize); } context.Add(FileCreationPathContextKey, CreationPath, true); } finally { if (null != srcFs) { srcFs.Close(); } if (null != dstFs) { dstFs.Close(); } } }
public EventDetailQueryHandlerShould() { var org = new Organization { Id = 1, Name = "Organization" }; var campaign = new Campaign { Id = 1, Name = "Campaign", ManagingOrganization = org }; var campaignEvent = new Event { Id = 1, Name = "Event", Campaign = campaign }; var task1 = new AllReadyTask { Id = 1, Name = "Task 1", Event = campaignEvent, NumberOfVolunteersRequired = 22 }; var task2 = new AllReadyTask { Id = 2, Name = "Task 2", Event = campaignEvent, NumberOfVolunteersRequired = 8 }; var user = new ApplicationUser { Id = Guid.NewGuid().ToString(), Email = "[email protected] " }; var user2 = new ApplicationUser { Id = Guid.NewGuid().ToString(), Email = "[email protected] " }; var taskSignup1 = new TaskSignup { User = user, Task = task1, Status = TaskStatus.Accepted.ToString() }; var taskSignup2 = new TaskSignup { User = user2, Task = task1, Status = TaskStatus.Accepted.ToString() }; var taskSignup3 = new TaskSignup { User = user, Task = task2, Status = TaskStatus.Accepted.ToString() }; Context.Add(campaign); Context.Add(campaignEvent); Context.Add(task1); Context.Add(task2); Context.Add(user); Context.Add(user2); Context.Add(taskSignup1); Context.Add(taskSignup2); Context.Add(taskSignup3); Context.SaveChanges(); }
/// <summary> /// Logins the specified user ID. /// </summary> /// <param name="user">The user.</param> /// <param name="createPersistentCookie">if set to <c>true</c> [create persistent cookie].</param> public void Login(User user, bool createPersistentCookie) { Context.Add(ContextKey.CurrentUser, user); FormsAuthentication.SetAuthCookie(user.UserID.ToString(), createPersistentCookie); }
public TEntity Add(TEntity entity) { Context.Add(entity); return(entity); }
protected override void LoadTestData() { var location = new Location { Address1 = "1 Some Road", City = "A town", State = "A state", PostalCode = "ZIP", Country = "United Kingdom" }; var itinerary1 = new Itinerary { Id = 1, Name = "Test Itinerary 1", StartLocation = location, EndLocation = location }; var itinerary2 = new Itinerary { Id = 2, Name = "Test Itinerary 2" }; var itinerary3 = new Itinerary { Id = 3, Name = "Test Itinerary 3", StartLocation = location, UseStartAddressAsEndAddress = false }; var request1 = new Request { RequestId = Request1Id, Name = "Request 1", Latitude = 50.8225, Longitude = -0.1372 }; var request2 = new Request { RequestId = Request2Id, Name = "Request 2", Latitude = 10.0000, Longitude = -5.0000 }; var request3 = new Request { RequestId = Request3Id, Name = "Request 3", Latitude = 10.0000, Longitude = -5.0000 }; var request4 = new Request { RequestId = Request4Id, Name = "Request 4", Latitude = 10.0000, Longitude = -5.0000 }; var itineraryRequest1 = new ItineraryRequest { Request = request1, Itinerary = itinerary1, OrderIndex = 1 }; var itineraryRequest2 = new ItineraryRequest { Request = request2, Itinerary = itinerary2 }; var itineraryRequest3 = new ItineraryRequest { Request = request3, Itinerary = itinerary3 }; var itineraryRequest4 = new ItineraryRequest { Request = request4, Itinerary = itinerary1, OrderIndex = 2 }; Context.Add(location); Context.Add(itinerary1); Context.Add(itinerary2); Context.Add(request1); Context.Add(request2); Context.Add(itineraryRequest1); Context.Add(itineraryRequest2); Context.Add(itineraryRequest3); Context.Add(itineraryRequest4); Context.SaveChanges(); }