当前位置: 首页>>代码示例>>C#>>正文


C# TestContext.WriteLine方法代码示例

本文整理汇总了C#中Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.WriteLine方法的具体用法?C# TestContext.WriteLine怎么用?C# TestContext.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.VisualStudio.TestTools.UnitTesting.TestContext的用法示例。


在下文中一共展示了TestContext.WriteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClassInitialize

 public static void ClassInitialize(TestContext testContext)
 {
     Console.WriteLine("ClassInitialize {0}", testContext.TestName);
     testContext.WriteLine("ClassInitialize");
     BufferPool.InitGlobalBufferPool(new MessagingConfiguration(false));
     ClientConfiguration cfg = ClientConfiguration.LoadFromFile("ClientConfigurationForTesting.xml");
     testContext.WriteLine(cfg.ToString());
     TraceLogger.Initialize(cfg);
 }
开发者ID:fgq841103,项目名称:orleans,代码行数:9,代码来源:PersistenceProviderTests.cs

示例2: ClassInitialize

 public static void ClassInitialize(TestContext testContext)
 {
     Console.WriteLine("ClassInitialize {0}", testContext.TestName);
     testContext.WriteLine("ClassInitialize");
     BufferPool.InitGlobalBufferPool(new MessagingConfiguration(false));
     ClientConfiguration cfg = ClientConfiguration.StandardLoad();
     testContext.WriteLine(cfg.ToString());
     TraceLogger.Initialize(cfg);
     LocalDataStoreInstance.LocalDataStore = null;
 }
开发者ID:sbambach,项目名称:orleans,代码行数:10,代码来源:HierarchicalKeyStoreTests.cs

示例3: EnsureImportBeforeTargetsExists

 /// <summary>
 /// Ensures that the ImportBefore targets exist in a test-specific folder
 /// </summary>
 public static string EnsureImportBeforeTargetsExists(TestContext testContext)
 {
     string filePath = Path.Combine(GetTestSpecificFolderName(testContext), ImportsBeforeFile);
     if (File.Exists(filePath))
     {
         testContext.WriteLine("ImportBefore target file already exists: {0}", filePath);
     }
     else
     {
         testContext.WriteLine("Extracting ImportBefore target file to {0}", filePath);
         EnsureTestSpecificFolder(testContext);
         ExtractResourceToFile("TestUtilities.Embedded.SonarQube.Integration.ImportBefore.targets", filePath);
     }
     return filePath;
 }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:18,代码来源:TestUtils.cs

示例4: EnsureDefaultPropertiesFileExists

 /// <summary>
 /// Ensures the default properties file exists in the specified folder
 /// </summary>
 public static string EnsureDefaultPropertiesFileExists(string targetDir, TestContext testContext)
 {
     string filePath = Path.Combine(targetDir, SonarQube.Common.FilePropertyProvider.DefaultFileName);
     if (File.Exists(filePath))
     {
         testContext.WriteLine("Default properties file already exists: {0}", filePath);
     }
     else
     {
         testContext.WriteLine("Extracting default properties file to {0}", filePath);
         Directory.CreateDirectory(targetDir);
         ExtractResourceToFile("TestUtilities.Embedded.SonarQube.Analysis.xml", filePath);
     }
     return filePath;
 }
开发者ID:nilleb,项目名称:sonar-msbuild-runner,代码行数:18,代码来源:TestUtils.cs

示例5: SynthTest

		public static long SynthTest(TestContext context, string name, int x, Action action)
		{
			GC.Collect();
			GC.WaitForPendingFinalizers();

			action();

			lock (watcher)
			{
				int i;

				watcher.Reset();
				watcher.Start();

				for (i = 0; i < x; i++)
				{
					action();
				}

				watcher.Stop();
			}

			context.WriteLine("{0}(x{1}): {2} ms, {3} ticks", name, x, watcher.ElapsedMilliseconds, watcher.ElapsedTicks);

			return watcher.ElapsedTicks;
		}
开发者ID:Interreto,项目名称:.net,代码行数:26,代码来源:Staging.cs

示例6: GetParameterValues

 private static object[] GetParameterValues(TestContext context, ParameterInfo[] parameters)
 {
     Func<ParameterInfo, int, object> selectFunc =
         (parameter, index) =>
         {
             context.WriteLine("{0} = {1}", parameter.Name, context.DataRow[index]);
             return context.DataRow[index];
         };
     return parameters.Select(selectFunc).ToArray();
 }
开发者ID:jeremybeavon,项目名称:MSTestCaseExtensions,代码行数:10,代码来源:ProvidesTestCasesAttribute.cs

示例7: AssemblyInitalize

        public static void AssemblyInitalize(TestContext context)
        {
            AppConfig.TestContext = context;

            SitefinityBaseTestCase.InitializeManager();
            try
            {
                ArtOfTest.WebAii.Core.Manager.Current.ConfigureBrowser(ArtOfTest.WebAii.Core.BrowserType.InternetExplorer, true);
            }
            catch (Exception e)
            {
                context.WriteLine("There was an error while trying to configure IE browser. Message: {0}\r\nStackTrace: {1}", e.Message, e.StackTrace);
            }
        }
开发者ID:emtammaru,项目名称:feather-widgets,代码行数:14,代码来源:FeatherTestCase.cs

示例8: LoadDeclarations

		public static void LoadDeclarations(TestContext testContext)
		{
			const String interopAssemblyName = "DotGecko.Gecko.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0ba2ce6fc89dc016";
			Assembly interopAssembly = Assembly.ReflectionOnlyLoad(interopAssemblyName);
			Assert.IsNotNull(interopAssembly);

			Type[] interopTypes = interopAssembly.GetTypes();
			ms_Interfaces = interopTypes
				.Where(type => type.IsInterface && (type.Name.StartsWith("nsI") || type.Name.StartsWith("mozI") || type.Name.StartsWith("imgI")))
				.ToList().AsReadOnly();
			ms_ConstClasses = interopTypes
				.Where(type => type.IsClass && (type.Name.StartsWith("nsI") || type.Name.StartsWith("mozI") || type.Name.StartsWith("imgI")) && type.Name.EndsWith(ConstClassSuffix))
				.ToList().AsReadOnly();

			IEnumerable<Type> unknownTypes = interopTypes.Except(ms_Interfaces).Except(ms_ConstClasses);
			foreach (Type unknownType in unknownTypes)
			{
				testContext.WriteLine("Unknown type: {0} ({1})", unknownType.Name, unknownType.FullName);
			}
		}
开发者ID:Happy-Ferret,项目名称:dotgecko,代码行数:20,代码来源:DeclarationsTest.cs

示例9: ApplyTests

        public static void ApplyTests( this ProblemCollection problems, TestContext context, params Test[] problemTests )
        {
            if( problemTests.Length == 0 ) {
                Assert.IsFalse( problems == null || problems.Count == 0, "Problems reported that are not tested" );
            } else {
                Assert.IsFalse( problems == null || problems.Count == 0, "No problems reported, but there should be {0}", problemTests.Length );

                var unusedTests = problemTests.AsEnumerable( );
                var untested = problems.Where(
                    p => {
                        var used = unusedTests.Where( pt => pt.IsSame( p ) );
                        unusedTests = unusedTests.Where( pt => !used.Contains( pt ) );
                        return used.Count( ) == 0;
                    }
                );

                bool hasUntested = untested.Count( ) > 0;
                bool hasUnused = unusedTests.Count( ) > 0;

                if( hasUntested ) {
                    if( context != null ) {
                        context.WriteLine( "Untested problems" );
                        foreach( var untestedItem in untested ) {
                            if( untestedItem.SourceFile != null ) context.WriteLine( "    File: {0}", untestedItem.SourceFile );
                            if( untestedItem.SourceLine != 0 ) context.WriteLine( "    Line: {0}", untestedItem.SourceLine );
                            if( untestedItem.Resolution != null ) {
                                var items = untestedItem.Resolution.Items;
                                if( items != null && items.Count > 0 ) {
                                    context.WriteLine( "    Data: {0}", items[0] );
                                    for( int i = 1; i < items.Count; i++ ) {
                                        context.WriteLine( "              {0}", items[i] );
                                    }
                                }
                            }
                            context.WriteLine( "" );
                        }
                    }

                }

                if( hasUnused ) {

                    if( context != null ) {
                        context.WriteLine( "Unraised problems" );
                        foreach( var unusedTest in unusedTests ) {

                            if( unusedTest.File != null ) context.WriteLine( "    File: {0}", unusedTest.File );
                            if( unusedTest.Line.HasValue ) context.WriteLine( "    Line: {0}", unusedTest.Line.Value );
                            if( unusedTest.Items != null && unusedTest.Items.Length > 0 ) {
                                context.WriteLine( "    Data: {0}", unusedTest.Items[0] );
                                for( int i = 1; i < unusedTest.Items.Length; i++ ) {
                                    context.WriteLine( "              {0}", unusedTest.Items[i] );
                                }

                            }
                            context.WriteLine( "" );
                        }
                    }
                }

                // fails at the end, so all information are written into test results details
                if( hasUntested ) {
                    Assert.Fail( "More problems reported than tests defined.{0}",
                        context != null ? "See test results details for more information" : "" );
                }
                if( hasUnused ) {
                    Assert.Fail( "More tests defined than problems reported.{0}",
                        context != null ? "See test results details for more information" : "" );
                }
            }
        }
开发者ID:WolfgangKluge,项目名称:fxcop-unit,代码行数:71,代码来源:FxCopTestHelper.cs

示例10: DeleteBlob

        internal static void DeleteBlob(string storageAccountName, Uri blobUri, AzureHttpClient client, TestContext context, CancellationToken token)
        {
            //this *always* calls GetStorageAccountProperties and GetStorageAccountKeys
            Uri blob, queue, table;

            context.WriteLine("Preparing to delete blob: {0}.", blobUri);

            context.WriteLine("Calling GetStorageAccountProperties and GetStorageAccountKeys for storage account {0}", storageAccountName);
            var storagePropsTask = client.GetStorageAccountPropertiesAsync(storageAccountName, token);
            var storageKeysTask = client.GetStorageAccountKeysAsync(storageAccountName, token);

            Task.WaitAll(storagePropsTask, storageKeysTask);

            context.WriteLine(storagePropsTask.Result.ToString());
            context.WriteLine(storageKeysTask.Result.ToString());

            FixupEndpoints(storagePropsTask.Result, out blob, out queue, out table);

            context.WriteLine("Instantiating Cloud Storage Account object.");

            CloudStorageAccount account = new CloudStorageAccount(
                                            new StorageCredentialsAccountAndKey(
                                                storagePropsTask.Result.Name,
                                                storageKeysTask.Result.Primary),
                                                blob, queue, table);

            context.WriteLine("Cloud Storage Account object intantiated.");

            CloudBlobClient blobClient = account.CreateCloudBlobClient();

            CloudBlob blobRef = blobClient.GetBlobReference(blobUri.ToString());

            context.WriteLine("Deleting blob {0}.", blobUri);

            blobRef.DeleteIfExists();

            context.WriteLine("Blob {0} deleted.", blobUri);
        }
开发者ID:tquinn86,项目名称:azure-sdk-for-net,代码行数:38,代码来源:Utilities.cs

示例11: SelectRandomRecordFromLookup

 public static string SelectRandomRecordFromLookup(
     TestContext testContext,
     UserContext context,
     ClientLogicalControl control,
     string keyFieldCaption)
 {
     var form = control.InvokeCatchLookup();
     if (form == null)
     {
         throw new InvalidOperationException("No Lookup Form found");
     }
     try
     {
         var randomKey = SelectRandomRecord(form, keyFieldCaption);
         testContext.WriteLine(
         "Selected Random Record from Lookup:{0} Key:{1} Value:{2}",
         control.Caption,
         keyFieldCaption,
         randomKey);
         return randomKey;
     }
     finally
     {
         ClosePage(testContext, context, form);
     }
 }
开发者ID:skmcavoy,项目名称:NAVLoadTest,代码行数:26,代码来源:TestScenario.cs

示例12: CloseSession

 private static void CloseSession(UserContext userContext, TestContext testContext)
 {
     try
     {
         using (new TestTransaction(testContext, "CloseSession"))
         {
             userContext.CloseSession();
         }
     }
     catch (Exception exception)
     {
         testContext.WriteLine("Error occurred on CloseSession {0}", exception.Message);
     }
 }
开发者ID:skmcavoy,项目名称:NAVLoadTest,代码行数:14,代码来源:TestScenario.cs

示例13: SaveValueAndIgnoreWarning

 /// <summary>
 /// Save the specified value with entry delay and ignore any warning dialogs
 /// </summary>
 /// <param name="context">the current test contest</param>
 /// <param name="userContext">the user context</param>
 /// <param name="control">the control to be updated</param>
 /// <param name="value">the value</param>
 /// <param name="ignoreAction">the name of the action, default is Yes</param>
 public static void SaveValueAndIgnoreWarning(TestContext context, UserContext userContext, ClientLogicalControl control, string value, string ignoreAction = "Yes")
 {
     var dialog = userContext.CatchDialog(() => SaveValueWithDelay(control, value));
     if (dialog != null)
     {
         try
         {
             var action = dialog.Action(ignoreAction);
             if (action != null)
             {
                 action.Invoke();
                 context.WriteLine("Dialog Caption: {0} Message: {1} was ignored with Action: {2} ", dialog.Caption, dialog.FindMessage(), ignoreAction);
             }
         }
         catch (InvalidOperationException)
         {
             context.WriteLine("Dialog Caption: {0} Message: {1} Action: {2} was not found.", dialog.Caption, dialog.FindMessage(), ignoreAction);
             throw;
         }
     }
 }
开发者ID:skmcavoy,项目名称:NAVLoadTest,代码行数:29,代码来源:TestScenario.cs

示例14: SelectRandomRecordFromListPage

 public static string SelectRandomRecordFromListPage(
     TestContext testContext,
     UserContext context,
     int pageId,
     string keyFieldCaption)
 {
     string randomKey = null;
     RunPageAction(testContext, context, pageId, form =>
     {
         randomKey = SelectRandomRecord(form, keyFieldCaption);
         testContext.WriteLine(
         "Selected Random Record from Page:{0} Key:{1} Value:{2}",
         pageId,
         keyFieldCaption,
         randomKey);
     });
     return randomKey;
 }
开发者ID:skmcavoy,项目名称:NAVLoadTest,代码行数:18,代码来源:TestScenario.cs

示例15: PollUntilComplete

        //This *always* calls the GetOperationStatus API
        internal static Action<Task<string>> PollUntilComplete(AzureHttpClient client, string operationName, TestContext context, CancellationToken token)
        {
            return (resultTask) =>
                {
                    string requestId = resultTask.Result;
                    context.WriteLine("Polling Operation: \"{0}.\" Request id is: {1}", operationName, requestId);
                    int curWaitTime = 1, lastWaitTime = 1;
                    Task<OperationStatusInfo> opStatus;
                    token.ThrowIfCancellationRequested();
                    do
                    {
                        context.WriteLine("\tOperation with id {0} is not complete, waiting {1} seconds.", requestId, curWaitTime);
                        Thread.Sleep(curWaitTime * 1000);
                        token.ThrowIfCancellationRequested();
                        int cur = curWaitTime;
                        curWaitTime += lastWaitTime;
                        lastWaitTime = cur;
                        context.WriteLine("\tCalling GetOperationStatus");
                        opStatus = client.GetOperationStatusAsync(requestId, token);
                        context.WriteLine(opStatus.Result.ToString());
                    } while (opStatus.Result.Status == OperationStatus.InProgress);

                    opStatus.Result.EnsureSuccessStatus();
                };
        }
开发者ID:tquinn86,项目名称:azure-sdk-for-net,代码行数:26,代码来源:Utilities.cs


注:本文中的Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。