本文整理汇总了C#中Context.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Add方法的具体用法?C# Context.Add怎么用?C# Context.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValuesOnDefaulAndConcurrentCtxObjs
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);
}
示例2: MyTestInitialize
[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);
}
示例3: CreateContext
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);
}
示例4: CreateContext
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);
}
示例5: CreatContext
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);
}
示例6: CreatContext
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);
}
示例7: MyTestInitialize
[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);
}
示例8: Create_FileCreateStep_TakeFromCtx
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);
}
示例9: InitialCase
/// <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);
}
示例10: InitialCellList
private void InitialCellList(Context context)
{
if (!context.ContainsKey(ContextKeys.CellList))
{
List<IACell> cellList = GetCellList(context);
context.Add(ContextKeys.CellList, cellList);
}
}
示例11: InitialCase
/// <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);
}
示例12: MyTestInitialize
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);
}
示例13: AddStudyIntoContext
/// <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);
}
示例14: Initial
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);
}
示例15: Initial
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);
}