我有一个我正在测试的方法.给定某些输入,它应该向记录器(ILogger)写入失败方法.该接口有几个Log()重载,以及一些属性(例如日志记录级别).我正在使用FakeItEasy嘲笑记录器.
我想断言的是发生了对Log()的调用.但是,我不关心使用了哪个特定的重载.我怎样才能做到这一点?
我的想法:
// Doesn't work, since a different overload (with more parameters) is used.
A.CallTo(() => mockLogger.Log(null)).WithAnyArguments().MustHaveHappened();
// "Works", but if the code were to call something else on the logger
// (ex. change the logging level), this would also pass!
Any.CallTo(mockLogger).MustHaveHappened();
Run Code Online (Sandbox Code Playgroud) 我试图在ScenarioContext.Current中插入一个值但由于某种原因ScenarioContext.Current为null.
我对报告的查询特别复杂.它从视图中选择多个列,并且必须通过聚合连接多个字段来构建列.为了使事情进一步复杂化,连接必须包含3个字段,即使实际上有0个(连接是逗号分隔的,因此仍然会注意到空字段).
我们使用的是Oracle 11.1.0.7.0.
为了提供向后兼容性(不是必需的),我们使用xmlagg函数来执行连接,我相信自Oracle 8或9以来一直存在.
这个例子将被简化,但我觉得提供了足够的信息.换句话说,请不要专注于规范表结构,这是一个严格的例子.
person_view
-----------
name
phone
address
position_id
position_table
--------------
position_id
position_title
Run Code Online (Sandbox Code Playgroud)
所以我们目前的查询,我承认不是一个SQL大师,是这样的:
select
name,
phone,
address,
(select
xmlagg(xmlelement(e, position_title || ',')).extract('//text()')
from
(select
position_title
from
position_table
where
position_table.position_id = person_view.position_id and
rownum <= 3
union all select '' from dual
union all select '' from dual
union all select '' from dual
)
where
rownum <= 3
)
from
person_view
Run Code Online (Sandbox Code Playgroud)
我的实际错误是,似乎确保至少3行输入的子查询不能引用祖父母查询来确定person_view.position_id.
我得到ORA-00904:"PERSON_VIEW"."POSITION_ID":无效的标识符
性能不是一个大问题,因为这是一个不会定期运行的报告,但我需要找出一个解决方案,用绝对的3列数据聚合这些数据.任何帮助重写查询或允许子查询访问相关祖父母列的指导都非常感谢.
对于任何有经验的C#开发人员来说,这可能是小菜一碟
您在此处看到的是异步Web服务器示例
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace SimpleServer
{
class Program
{
public static void ReceiveCallback(IAsyncResult AsyncCall)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
Byte[] message = encoding.GetBytes("I am a little busy, come back later!");
Socket listener = (Socket)AsyncCall.AsyncState;
Socket client = listener.EndAccept(AsyncCall);
Console.WriteLine("Received Connection from {0}", client.RemoteEndPoint);
client.Send(message);
Console.WriteLine("Ending the connection");
client.Close();
listener.BeginAccept(new AsyncCallback(ReceiveCallback), listener);
}
public static void Main()
{
try
{
IPAddress localAddress = IPAddress.Parse("127.0.0.1");
Socket listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); …Run Code Online (Sandbox Code Playgroud) 安装了Windows Web服务器2008 R2 64位,CF9 64位,IIS7,ISAPI扩展和过滤器以及II6元数据库兼容性.操作系统默认为C,并尝试将CF安装到D:
测试IIS并在http://localhost/index.html上的 c:\ inetpub\wwwroot中正确显示index.html
然后我将CF安装到D:\,单个标准服务器许可证,选择运行所有IIS站点,选择C:\ inetpub\wwwroot作为管理员的Web根目录,当它到达应该打开管理员的位要完成安装,它会以500错误打开浏览器.
现在当我回到http://localhost/index.html我也得到500错误,如果我卸载CF我可以再次到达html页面.
CFIDE已经大概正确安装在C:\ inetpub\wwwroot中.谁能告诉我哪里出错了.
更新
确切的IIS错误是
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Module IsapiModule
Notification ExecuteRequestHandler
Handler AboMapperCustom-28262
Error Code 0x800700c1
Requested URL http://127.0.0.1:80/test.htm
Physical Path C:\inetpub\wwwroot\test.htm
Logon Method Anonymous
Logon User Anonymous
Run Code Online (Sandbox Code Playgroud)
解决方法如下
我已经开始学习C和指针了,我一直在互联网上学习教程.我假设代码应该像教程一样工作,对我来说似乎是正确的,但是我得到了分段错误.代码是:
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
int main(int argc, char** argv) {
float fl = 3.14;
unsigned int addr = (unsigned int) &fl;
printf("fl's address=%u\n", addr);
printf("addr's contents = %.2f\n", * (float*) addr);
return (EXIT_SUCCESS);
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是
/Applications/NetBeans/NetBeans
6.9.1.app/Contents/Resources/NetBeans/ide/bin/nativeexecution/dorun.sh: line 33: 1626
Segmentation fault sh "${SHFILE}"
Run Code Online (Sandbox Code Playgroud)
这与我使用Mac有什么关系,或者代码有问题吗?
非常感谢,Niek
在以下SQL中:
SELECT * FROM X WHERE Y LIKE "%s";
Run Code Online (Sandbox Code Playgroud)
'%'将匹配之前的任何字符%.该s可%,x,xx,等.
是否有任何符号只匹配一个字符,如:
SELECT * FROM X WHERE Y LIKE "?s"
Run Code Online (Sandbox Code Playgroud)
哪里xrf只匹配一个字符,如'a','b','c'等?
可能重复:
如何从R脚本中读取命令行参数?
我有一个R脚本,我希望能够提供几个命令行参数(而不是代码本身的硬编码参数值).该脚本在linux上运行.
我无法找到如何在命令行Bash上读取R.script.
sh文件
cd `dirname $0`
/usr/lib64/R/bin/R --vanilla --slave "--args input='$1' input2='$2' output='$3'" file=/home/lvijfhuizen/galaxy_dist/tools/lisanne/partone.R $3.txt
Run Code Online (Sandbox Code Playgroud)
R档
args <- commandArgs()
file <- read.csv(args[8],head=TRUE,sep="\t")
annfile <- read.csv(args[9],head=TRUE,sep="\t")
Run Code Online (Sandbox Code Playgroud) 我有一个堆栈面板,我想动态添加一些图标.
如果我将一个TextBlock添加到堆栈面板,它可以完美地工作:
// assuming stackPanel is my stack panel
let text = new TextBlock()
text.Text <- "Test"
stackPanel.Children.add(text)
Run Code Online (Sandbox Code Playgroud)
但是,我的目标是添加图像,但似乎无法解析图像
let getImageSource(imagePath) =
let uri = new Uri(imagePath, UriKind.Relative)
new BitmapImage(uri);
let icon = new Image()
icon.Source <- getImageSource("images/fileIcon/icon.gif")
stackPanel.Children.Add(icon) // this doesnt work
Run Code Online (Sandbox Code Playgroud)
现在我做的时候:
let icon = new Image()
icon.Source <- getImageSource("images/fileIcon/icon.gif")
stackPanel.Children.Add(icon)
let text = new TextBlock()
text.Text <- "Test"
stackPanel.Children.add(text)
Run Code Online (Sandbox Code Playgroud)
我可以看到文本之间有一个空白区域,好像那里有一个空图像.所以我的猜测是我解决图像路径的方式有问题 - 但我不确定原因.
思考?
谢谢!
我一直在使用SpecFlow进行验收测试.这使用Gherkin(DSL Cucumber使用).它包含一个名为"标签"的有趣功能.我可以看到它的实用性,但我不确定在BDD中使用标签可能构成什么样的好习惯.
我用谷歌搜索了一下,但不幸的是,包括"Tag"这个词与许多非Gherkin标签相匹配(就像这个页面上的那些!)
我希望在Cucumber维基上找到一些帮助,但标签主题尚未编写.
我发现声明"您可以使用标签将功能和方案分组,与您的文件和目录结构无关",但我恐怕不知道这意味着什么!
c# ×2
specflow ×2
asyncsocket ×1
bash ×1
c ×1
coldfusion ×1
cucumber ×1
f# ×1
fakeiteasy ×1
gherkin ×1
http-headers ×1
installation ×1
macos ×1
mysql ×1
oracle ×1
r ×1
silverlight ×1
sql ×1
unit-testing ×1
webserver ×1