本文整理汇总了C#中System.Collections.ObjectModel.Collection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ObjectModel.Collection.Add方法的具体用法?C# System.Collections.ObjectModel.Collection.Add怎么用?C# System.Collections.ObjectModel.Collection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ObjectModel.Collection
的用法示例。
在下文中一共展示了System.Collections.ObjectModel.Collection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestPrm_FilterDescriptionContains
public void TestPrm_FilterDescriptionContains()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 1"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 3"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TMXTestSuite -Name 'suite%%`1 1'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 1'; " +
@"$null = Add-TMXTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`2 2'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = Close-TMXTestResult -Name 'test result`r`n%% 1' -Description 'abc' -TestPassed; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 3'; " +
@"$null = Close-TMXTestResult -Name 'test result`r`n%% 2' -Id 01 -TestPassed; " +
@"$null = Add-TMXTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`3 3'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`4 4'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 4'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`5 5'; " +
@"$null = Close-TMXTestResult -Name 'test result`r`n%% 3' -Description 'cab' -TestPassed; " +
@"$null = Close-TMXTestResult -Name 'a' -Id '003' -Description 'ccc' -TestPassed; " +
@"Search-TMXTestResult -FilterDescriptionContains 'ab' | %{$_.Name;}",
coll);
}
示例2: initRuby
private void initRuby()
{
ScriptRuntimeSetup runtimeSetup = ScriptRuntimeSetup.ReadConfiguration();
var languageSetup = IronRuby.RubyHostingExtensions.AddRubySetup(runtimeSetup);
runtimeSetup.DebugMode = false;
runtimeSetup.PrivateBinding = false;
runtimeSetup.HostType = typeof(RhoHost);
languageSetup.Options["NoAdaptiveCompilation"] = false;
languageSetup.Options["CompilationThreshold"] = 0;
languageSetup.Options["Verbosity"] = 2;
m_runtime = IronRuby.Ruby.CreateRuntime(runtimeSetup);
m_engine = IronRuby.Ruby.GetEngine(m_runtime);
m_context = (RubyContext)Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetLanguageContext(m_engine);
m_context.ObjectClass.SetConstant("RHO_WP7", 1);
m_context.ObjectClass.AddMethod(m_context, "__rhoGetCallbackObject", new RubyLibraryMethodInfo(
new[] { LibraryOverload.Create(new Func<System.Object, System.Int32, System.Object>(RhoKernelOps.__rhoGetCallbackObject), false, 0, 0) },
RubyMethodVisibility.Public,
m_context.ObjectClass
));
m_context.Loader.LoadAssembly("RhoRubyLib", "rho.rubyext.rubyextLibraryInitializer", true, true);
System.Collections.ObjectModel.Collection<string> paths = new System.Collections.ObjectModel.Collection<string>();
paths.Add("lib");
paths.Add("apps/app");
m_engine.SetSearchPaths(paths);
}
示例3: initRuby
private void initRuby()
{
ScriptRuntimeSetup runtimeSetup = ScriptRuntimeSetup.ReadConfiguration();
var languageSetup = IronRuby.RubyHostingExtensions.AddRubySetup(runtimeSetup);
runtimeSetup.DebugMode = false;
runtimeSetup.PrivateBinding = false;
runtimeSetup.HostType = typeof(RhoHost);
languageSetup.Options["NoAdaptiveCompilation"] = false;
languageSetup.Options["CompilationThreshold"] = 0;
languageSetup.Options["Verbosity"] = 2;
m_runtime = IronRuby.Ruby.CreateRuntime(runtimeSetup);
m_engine = IronRuby.Ruby.GetEngine(m_runtime);
m_context = (RubyContext)Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetLanguageContext(m_engine);
m_context.ObjectClass.SetConstant("RHO_WP7", 1);
m_context.Loader.LoadAssembly("RhoRubyLib", "rho.rubyext.rubyextLibraryInitializer", true, true);
System.Collections.ObjectModel.Collection<string> paths = new System.Collections.ObjectModel.Collection<string>();
paths.Add("lib");
paths.Add("apps/app");
m_engine.SetSearchPaths(paths);
}
示例4: TestPrm_Name_Complex_In_Series
public void TestPrm_Name_Complex_In_Series()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(null);
coll.Add(new System.Management.Automation.PSObject("autoclosed"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 1"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 2"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 3"));
coll.Add(new System.Management.Automation.PSObject("autoclosed"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TmxTestSuite -Name 'suite%%`1 1'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 1'; " +
@"$null = Add-TmxTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`2 2'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = Close-TmxTestResult -Name 'test result`r`n%% 1' -TestPassed; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 3'; " +
@"$null = Close-TmxTestResult -Name 'test result`r`n%% 2' -TestPassed; " +
@"$null = Add-TmxTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`3 3'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`4 4'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 4'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`5 5'; " +
@"$null = Close-TmxTestResult -Name 'test result`r`n%% 3' -TestPassed; " +
@"Search-TmxTestResult -OrderById | %{$_.Name;}",
coll);
}
示例5: TestMercator_1SP_Projection
public void TestMercator_1SP_Projection()
{
CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();
IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre);
IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null);
IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum,
PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East),
new AxisInfo("Lat", AxisOrientationEnum.North));
//System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>(5);
System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>();
parameters.Add(new ProjectionParameter("latitude_of_origin", 0));
parameters.Add(new ProjectionParameter("central_meridian", 110));
parameters.Add(new ProjectionParameter("scale_factor", 0.997));
parameters.Add(new ProjectionParameter("false_easting", 3900000));
parameters.Add(new ProjectionParameter("false_northing", 900000));
IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters);
IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys);
SharpMap.Geometries.Point pGeo = new SharpMap.Geometries.Point(120, -3);
SharpMap.Geometries.Point pUtm = trans.MathTransform.Transform(pGeo);
SharpMap.Geometries.Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm);
SharpMap.Geometries.Point expected = new Point(5009726.58, 569150.82);
Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString()));
Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString()));
}
示例6: Ancestors_1
private void Ancestors_1(string driverName)
{
System.Collections.ObjectModel.Collection<PSObject> coll =
new System.Collections.ObjectModel.Collection<PSObject>();
//coll.Add((new PSObject(" Value1\r\n Value 2\r\n Value \\3\r\n Value /4\r\n ")));
coll.Add((new PSObject("div3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("div2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("div1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("My First Heading\r\ndiv1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("My First Heading\r\ndiv1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
// coll.Add((new PSObject("Test results 26.07.2012 16:16
// Value1
// Value 2
// Value \3
// Value /4
//
// Value1
// Value 2
// Value \3
// Value /4
//
// Value1
// Value 2
// Value \3
// Value /4
//
//Value1 Value 2 Value \3 Value /4
// Value1
// Value 2
// Value \3
// Value /4
//
//Value1 Value 2 Value \3 Value /4
//Suites:1 Passed:0 Failed:1 Not tested:0
//Scenarios:2 Passed:0 Failed:2 Not tested:0
//Test cases:21 Passed:11 Failed:7 Not tested:3 Time spent:6 seconds
//4 cases of non-critical issues are counted as Passed
//111 suite1 FAILED
//Scenarios:2 Passed:0 Failed:2 Not tested:0
//Test cases:21 Passed:11 Failed:7 Not tested:3 Time spent:6 seconds
//description description description description description description description description description description>
//)));
//coll.Add((new PSObject(Settings.TestFile05Controls1ElementSelect01Value03Name)));
//coll.Add((new PSObject(Settings.TestFile05Controls1ElementSelect01Value04Name)));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"Start-SeWebDriver -DriverName '" +
driverName +
@"' | Enter-SeURL -URL '" +
MiddleLevelCode.GetURLFromPath(System.IO.Path.GetFullPath(Settings.TestFile06Controls1)) +
@"' | Get-SeWebElement -XPath '" +
Settings.TestFile06Controls1Element01XPath +
//@"' | Get-SeWebElementAncestors | %{ $_ | Read-SeWebElementText; }",
@"' | Get-SeWebElementAncestors | Read-SeWebElementText;",
coll);
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>> parameters = new System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>>();
System.Collections.ObjectModel.Collection<KeyValuePair<string, string>> list = new System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>();
list.Add(new KeyValuePair<string, string>("@transaction_master_id", this.Request["TranId"]));
parameters.Add(list);
parameters.Add(list);
DirectPurchaseInvoiceReport.ParameterCollection = parameters;
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>> parameters = new System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>>();
System.Collections.ObjectModel.Collection<KeyValuePair<string, string>> list = new System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>();
list.Add(new KeyValuePair<string, string>("@non_gl_stock_master_id", this.Request["TranId"]));
parameters.Add(list);
parameters.Add(list);
SalesQuotationReport.ParameterCollection = parameters;
}
示例9: TestPrm_FilterDescriptionContains_Descending
public void TestPrm_FilterDescriptionContains_Descending()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(new System.Management.Automation.PSObject("suite4"));
coll.Add(new System.Management.Automation.PSObject("suite1"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TMXTestSuite -Name suite1 -Description 'abc'; " +
@"$null = New-TMXTestSuite -Name suite2 -Description 'bac'; " +
@"$null = New-TMXTestSuite -Name suite3; " +
@"$null = New-TMXTestSuite -Name suite4 -Description 'cab'; " +
@"$null = New-TMXTestSuite -Name suite5 -Description 'bac'; " +
@"Search-TMXTestSuite -FilterDescriptionContains 'ab' -Descending | %{$_.Name;}",
coll);
}
示例10: InitializeView
/// <summary>
/// Initialises the view.
/// </summary>
/// <param name="grid">The layoutRoot grid.</param>
/// <param name="columnManager">Look ahead view column manager.</param>
public void InitializeView(Grid grid, ColumnManager columnManager)
{
System.Collections.ObjectModel.Collection<ColumnManager> columns = new System.Collections.ObjectModel.Collection<ColumnManager>();
columns.Add(columnManager);
this.view = new ColumnView(grid, columns, true);
}
示例11: getAssociations
public System.Collections.ObjectModel.Collection<UIElement> getAssociations()
{
System.Collections.ObjectModel.Collection<UIElement> asses = new System.Collections.ObjectModel.Collection<UIElement>();
if ((this.Child as StackPanel).Children.Count > 1)
{
Canvas assocCanvas = null;
foreach (UIElement u in (this.Child as StackPanel).Children)
if (u is Canvas)
{
assocCanvas = u as Canvas;
break;
}
if (assocCanvas != null)
{
foreach (UIElement u in assocCanvas.Children)
{
if ((u as VisualElement).Content is UMLAssociation)
{
asses.Add(u);
//((u as VisualElement).Content as UMLAssociation).drawArrow(new Point(0, 0), new Point(300, 300));
//Canvas.SetTop((u as VisualElement), 30);
//Canvas.SetLeft((u as VisualElement), 5);
//Canvas.SetZIndex(u, 6);
}
}
}
}
return asses;
}
示例12: TestPrm_Name_Simple_In_Series
public void TestPrm_Name_Simple_In_Series()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(new System.Management.Automation.PSObject("scenario1"));
coll.Add(new System.Management.Automation.PSObject("scenario2"));
coll.Add(new System.Management.Automation.PSObject("scenario4"));
coll.Add(new System.Management.Automation.PSObject("scenario2"));
coll.Add(new System.Management.Automation.PSObject("scenario3"));
coll.Add(new System.Management.Automation.PSObject("scenario2"));
coll.Add(new System.Management.Automation.PSObject("scenario5"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TmxTestSuite -Name suite1; " +
@"$null = Add-TmxTestScenario -Name scenario1; " +
@"$null = New-TmxTestSuite -Name suite2; " +
@"$null = New-TmxTestSuite -Name suite3; " +
@"$null = Add-TmxTestScenario -Name scenario2; " +
@"$null = Add-TmxTestScenario -Name scenario3; " +
@"$null = New-TmxTestSuite -Name suite4; " +
@"$null = Add-TmxTestScenario -Name scenario4; " +
@"$null = Add-TmxTestScenario -Name scenario2; " +
@"$null = Add-TmxTestScenario -Name scenario5; " +
@"$null = New-TmxTestSuite -Name suite5; " +
@"$null = Add-TmxTestScenario -Name scenario2; " +
@"Search-TmxTestScenario -OrderById | %{$_.Name;}",
coll);
}
示例13: TestPrm_Name_Complex_In_Series
public void TestPrm_Name_Complex_In_Series()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(new System.Management.Automation.PSObject("suite%%`1 1"));
coll.Add(new System.Management.Automation.PSObject("suite%%`2 2"));
coll.Add(new System.Management.Automation.PSObject("suite%%`3 3"));
coll.Add(new System.Management.Automation.PSObject("suite%%`4 4"));
coll.Add(new System.Management.Automation.PSObject("suite%%`5 5"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TmxTestSuite -Name 'suite%%`1 1'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`2 2'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`3 3'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`4 4'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`5 5'; " +
@"Search-TmxTestSuite -OrderById | %{$_.Name;}",
coll);
}
示例14: TestPrm_Id_Numeric
public void TestPrm_Id_Numeric()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(new System.Management.Automation.PSObject("1"));
coll.Add(new System.Management.Automation.PSObject("2"));
coll.Add(new System.Management.Automation.PSObject("3"));
coll.Add(new System.Management.Automation.PSObject("4"));
coll.Add(new System.Management.Automation.PSObject("5"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TmxTestSuite -Name abc1 -Id 1; " +
@"$null = New-TmxTestSuite -Name abc2 -Id 2; " +
@"$null = New-TmxTestSuite -Name abc3 -Id 3; " +
@"$null = New-TmxTestSuite -Name abc4 -Id 4; " +
@"$null = New-TmxTestSuite -Name abc5 -Id 5; " +
@"Search-TmxTestSuite -OrderById | %{$_.Id;}",
coll);
}
示例15: TestPrm_Id_WebDriverInput
private void TestPrm_Id_WebDriverInput(string driverName)
{
System.Collections.ObjectModel.Collection<PSObject> coll =
new System.Collections.ObjectModel.Collection<PSObject>();
coll.Add((new PSObject(Settings.TestFile05Controls1ElementLink03Answer)));
coll.Add((new PSObject(Settings.TestFile05Controls1ElementLink04Answer)));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"Start-SeWebDriver -DriverName '" +
driverName +
@"' | Enter-SeURL -URL '" +
MiddleLevelCode.GetURLFromPath(System.IO.Path.GetFullPath(Settings.TestFile05Controls1)) +
@"' | Get-SeWebElement -Id '" +
Settings.TestFile05Controls1ElementLinkIds +
//@"' | %{ $_ | Read-SeWebElementText; }",
@"' | Read-SeWebElementText;",
coll);
}