我真是在这里撞墙.在Visual Studio(Express 2013)中获取程序输出是如此困难吗?在编写代码时,我发现在工作和故障排除时能够打印出变量,操作等的值是绝对必要的.
在Java和Eclipse中,System.out.println()总是有效,打印到IDE控制台.在编写C程序时,我总是使用控制台,所以回声任何事都没问题.但是,在VS Express 2013中我似乎无法获得任何输出.
问题可能与我正在编写单元测试而不是"正常"可执行程序这一事实有关吗?如果是这样,有没有办法让VS在单元测试类中显示程序输出?我尝试过使用调试,但这也没有显示任何内容.认为存在配置问题,我已经找到了调试未显示的消息的解决方案,但我找到的任何选项(在这里或其他地方)似乎没有帮助.
或者,当然 - 如果在VS/C#中编写代码时有另一种常用的方法来检查程序值,输出等,我想听听它:-)
有人有任何想法吗?如果问题太不明确或者其他问题,请告诉我,我会解决它.
注意:我正在使用单元测试类进行功能测试,以防有人想指出我应该做什么,而不应该做单元测试.
编辑1:我忘了提到我无法使用"Start:Debug"运行代码.如果我尝试,我会收到此错误:"无法直接启动具有类库输出类型的项目." (单元测试项目使用另一个项目中的类,即类库项目.)这当然是因为我在解决方案中没有可执行项目.我运行它的方法是从Test Explorer运行选定的测试.
编辑2:代码:
using System;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WordpressAutomation;
namespace WordpressTests
{
[TestClass]
public class LoginTests : WordpressTest {
[TestMethod]
public void AdminUserCanLogIn() {
System.Diagnostics.Debug.WriteLine("Something...");
System.Diagnostics.Trace.WriteLine("Something...");
}
}
}
Run Code Online (Sandbox Code Playgroud) c# unit-testing visual-studio-express output visual-studio-2013
我知道对于多部分写入,我应该在nhibernate中使用事务.然而,对于简单的读写操作(1部分)...我已经读过,总是使用事务是一种好习惯.这需要吗?
我应该做一下简单的阅读吗?或者我可以将交易部分全部丢弃?
public PrinterJob RetrievePrinterJobById(Guid id)
{
using (ISession session = sessionFactory.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
var printerJob2 = (PrinterJob) session.Get(typeof (PrinterJob), id);
transaction.Commit();
return printerJob2;
}
}
}
Run Code Online (Sandbox Code Playgroud)
要么
public PrinterJob RetrievePrinterJobById(Guid id)
{
using (ISession session = sessionFactory.OpenSession())
{
return (PrinterJob) session.Get(typeof (PrinterJob), id);
}
}
Run Code Online (Sandbox Code Playgroud)
简单的写作怎么样?
public void AddPrintJob(PrinterJob printerJob)
{
using (ISession session = sessionFactory.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
session.Save(printerJob);
transaction.Commit();
}
}
}
Run Code Online (Sandbox Code Playgroud) 是否可以设置jQGrid的宽度百分比?如果是,那怎么样?
`我不确定要插入什么代码甚至在哪里,但我想检查我输入的数字是一个奇数.
import java.io.*;
import javax.swing.JOptionPane;
public class Diamond {
public static void main(String [] args) throws IOException {
BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
String input;
int num;
System.out.println("input number: ");
input = stdin.readLine ();
num = Integer.parseInt(input);
if (num % 2 ==1){
int d = num;
int e = 0;
for (int a = 0; a <= num; a++) {
for (int c = d; c>= 1; c-- )
System.out.print(" ");
d-=1;
for (int b = 1; …Run Code Online (Sandbox Code Playgroud) 我使用Asp.net web API为客户端提供api(iphone,android,mac os,web,windows,...).我想实现一些具有更高安全性的API,我阻止其他一些人理解链接中的参数(如果他们破解了链接)
我的问题是:我可以使用Https/SSL吗?它足够安全吗?如果是,我应该在客户端安装任何东西来实现吗?
谢谢
我有一个列表集合如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace FileExplorer.Classes
{
public class NewAddedFiles
{
public string FileName;
public string FilePath;
public DateTime FileCreationDate;
}
}
Run Code Online (Sandbox Code Playgroud)
private void GetFilesFromDirectory(string PhysicalPath)
{
DirectoryInfo Dir = new DirectoryInfo(PhysicalPath);
FileInfo[] FileList = Dir.GetFiles("*.*", SearchOption.AllDirectories);
List<NewAddedFiles> list = new List<NewAddedFiles>();
NewAddedFiles NewAddedFile = new NewAddedFiles();
foreach (FileInfo FI in FileList)
{
//Response.Write(FI.FullName);
//Response.Write("<br />");
string AbsoluteFilePath = FI.FullName;
string RelativeFilePath = "~//" + AbsoluteFilePath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty);
NewAddedFile.FileName = FI.Name;
NewAddedFile.FilePath = RelativeFilePath;
NewAddedFile.FileCreationDate = …Run Code Online (Sandbox Code Playgroud) 我想转换一个Brush对象,Color以便我可以将任何xaml按钮背景颜色更改为light color按钮单击,但System.Windows.Forms.ControlPaint.Light()只使用颜色作为参数.
有没有替代方案来实现这一目标?
当jqGrid为空时,我想在网格内显示单个空行,并显示没有任何数据的信息消息.这怎么可能?谢谢
structuremap是否允许您以懒惰的方式进行构造函数注入?意思是不创建在使用之前注入的对象?
我想了解更多有关linq的信息,例如,如果我想实现一个Select,我会像这样实现
public static IEnumerable<TResult> Select<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, TResult> selector)
{
foreach (var item in source)
{
yield return selector(item);
}
}
Run Code Online (Sandbox Code Playgroud)
这样的地方
public static IEnumerable<TSource> Where<TSource>(IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
foreach (var item in source)
{
if (predicate(item))
yield return item;
}
}
Run Code Online (Sandbox Code Playgroud)
OrderBy怎么样?
c# ×7
.net ×3
javascript ×2
jqgrid ×2
asp.net ×1
collections ×1
colors ×1
datasource ×1
dependencies ×1
https ×1
java ×1
java-io ×1
linq ×1
nhibernate ×1
output ×1
repeater ×1
ssl ×1
structuremap ×1
transactions ×1
unit-testing ×1
winforms ×1
wpf ×1
xaml ×1