我刚刚开始测试xUnit.net,但它似乎没有像我期望的那样捕获任何输出(控制台,调试,跟踪).
那可能吗?我正在使用带有xUnit.net 1.8的示例.NET 4.0类库.
我正在尝试创建一个能够运行各种Powershell脚本的Windows应用程序.
我有一个脚本,它应该工作(从Powershell提示符运行时),我的Windows应用程序似乎执行它应该,但它无法在我的OU上找到方法.
当我从Windows应用程序执行脚本时,我收到这些消息:
错误:检索成员"创建"时发生以下异常:"服务器上没有此类对象."
错误:检索成员"删除"时发生以下异常:"服务器上没有此类对象."
Powershell脚本:
function New-AdUser {
param (
[string] $Username = $(throw "Parameter -Username [System.String] is required."),
[string] $Password = $(throw "Parameter -Password [System.String] is required."),
[string] $OrganizationalUnit = "Users",
[string] $DisplayName,
[string] $FirstName,
[string] $LastName,
[string] $Initials,
[string] $MobilePhone,
[string] $Description,
[switch] $CannotChangePassword,
[switch] $PasswordNeverExpires,
[switch] $Disabled
)
try {
$currentDomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$dn = $currentDomain.GetDirectoryEntry().distinguishedName
$ou = [ADSI] "LDAP://CN=$OrganizationalUnit,$dn"
$userAccount = $ou.Create("user", "cn=$Username")
$userAccount.SetInfo()
$userAccount.userAccountControl = ($userAccount.userAccountControl.Item(0) -bxor 0x0002) #Enable the account
$userAccount.SetInfo()
$userAccount.sAMAccountName = …
Run Code Online (Sandbox Code Playgroud) 我试图在MVC3中使用Razor语法创建一个非常简单的视图,但似乎我无法正确使用语法.
我有一个像这样的简单表
<table>
<tr>
@{
var counter = 0;
}
@foreach (var category in ViewBag.Categories)
{
counter++;
<td>
<input type="checkbox" checked="checked" name="@("category" + category.Code)" />
@category.Description
</td>
if (counter % 2 == 0)
{
</tr>
<tr>
}
}
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
当我在if语句中插入和内部时,我收到此错误
using块缺少一个结束"}"字符.
如果我尝试将这两个标签包装在里面,我会得到这个错误:
"tr"元素未关闭.
我刚刚使用NuGet升级到最新的EF 4.1代码,现在我收到有关映射的错误.
我有这门课
public class UserApplication
{
[Key, Column(Order = 0)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int UserId { get; set; }
[Key, Column(Order = 1)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int ApplicationId { get; set; }
[ForeignKey("ApplicationId")]
public virtual Application Application { get; set; }
public DateTime SubscribedDate { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我收到这个错误:
System.Data.Edm.EdmEntityType: : EntityType 'UserApplication' has no key defined. Define the key for this EntityType.
System.Data.Edm.EdmEntitySet: EntityType: EntitySet 'UserApplications' is based on type 'UserApplication' that has no keys defined.
Run Code Online (Sandbox Code Playgroud)
但是,我可以使用像这样的Fluent API
modelBuilder.Entity<UserApplication>().HasKey(obj …
Run Code Online (Sandbox Code Playgroud) 我目前正在构建一个应用程序,以便从ASP.NET MVC网站自动执行某些Exchange 2010操作.
现在,当我尝试调用New-AddressList命令时,我遇到了一个ParameterBindingException.
我正在尝试创建以下调用(其工作):
new-AddressList -Name "7 AL" -RecipientContainer "myDomain.local/Customers/7" -IncludedRecipients 'AllRecipients' -Container '\' -DisplayName "7 AL"
Run Code Online (Sandbox Code Playgroud)
我是通过以下方式完成的:
var NewAddressList = new Command("New-AddressList");
NewAddressList.Parameters.Add("Name", "7 AL");
NewAddressList.Parameters.Add("RecipientContainer", "myDomain.local/Customers/7");
NewAddressList.Parameters.Add("IncludedRecipients", "AllRecipients");
NewAddressList.Parameters.Add("Container", @"\");
NewAddressList.Parameters.Add("DisplayName", "7 AL");
CommandsList.Add(NewAddressList);
Run Code Online (Sandbox Code Playgroud)
这个命令列表提供给我调用的管道,给出了以下错误:
New-AddressList:输入对象不能绑定到命令的任何参数,因为该命令不接受管道输入或输入及其属性与接受管道输入的任何参数都不匹配.
任何可能导致这种情况的线索?
使用Trace-Command输出给出:
PS C:\Users\ext_kefu> Trace-Command -Name parameterbinding -Expression {New-AddressList -Name "7 AL" -RecipientContainer "myDomain.local/Customers/7" -IncludedRecipients 'AllRecipients' -Container '\' -DisplayName "7 AL"} -PSHost
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [New-AddressList]
DEBUG: ParameterBinding Information: 0 : BIND …
Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery Mobile开发PhoneGap应用程序.目前我只在iPhone和iPhone Retina模拟器中进行测试.
当我在Retina模式下打开应用程序时,应用程序的密度是正确的,但页面只是两个维度上屏幕尺寸的一半.
我自己的猜测是jQuery Mobile的css没有扩大宽度和高度,但我还没有找到任何关于此的东西.
我的HTML有这个:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
Run Code Online (Sandbox Code Playgroud)
然后我执行这个Javascript:
if ($.mobile.media("screen and (min-width: 320px)")) {
if ($.mobile.media("screen and (-webkit-min-device-pixel-ratio: 2)")) {
$('meta[name=viewport]').attr('content','width=device-width, user-scalable=no,initial-scale=.5, maximum-scale=.5, minimum-scale=.5');
}
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我希望我的网站(C#)每隔15分钟调用异步到一些c#函数我该怎么做?
谢谢