使用Visual Studio 2008所具有的框架,我是否因为不使用像NUnit这样的外部工具而遗漏了什么?从我可以看出,使用NUnit似乎更麻烦的是手动创建测试类和方法而不是右键单击IDE本机.话虽如此,我是否缺少NUnit提供的VS不包含的功能?有一个简单的GUI供我的QA人员访问很好,但是使用nAnt和构建依赖于单元测试传递,我是否缺少很酷的功能?
我认为,这是一个非常直接的设置,其中创建搜索类型并将其传递到服务层并进入存储库,其中返回域类型的列表.搜索类型除了在存储库方法中构造表达式树之外什么都不做,基本上数据库的结果会返回.很简单
存储库界面:
public interface IDoNotSolicitRepo
{
IList<DNSContract> SelectWithCriteria(DNS_Search searchriteria);
}
Run Code Online (Sandbox Code Playgroud)
实现存储库的服务:
public class DoNotSolicitService : BaseBLLService, IDoNotSolicitService
{
private readonly IDoNotSolicitRepo repo;
private readonly IPartnerService partnerService;
private readonly IDoNotSolicitReasonService dnsReasonSvc;
public DoNotSolicitService(IDoNotSolicitRepo _repo, IPartnerService _partnerSvc, IDoNotSolicitReasonService _dnsReasonSvc)
{
repo = _repo;
partnerService = _partnerSvc;
dnsReasonSvc = _dnsReasonSvc;
}
public ServiceResult<DNSContract> SelectWithCriteria(DNS_Search searchriteria)
{
var results = repo.SelectWithCriteria(searchriteria);
return ReturnServiceResult(results);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在努力学习这个项目的Moq,我无法弄清楚我是否应该使用Callback()或Return().我得到了两者的总分,但现在似乎都不适合我.
考试:
[Test]
public void SelectWithCriteria_FirstName()
{
mockRepository.Setup(mr => mr.SelectWithCriteria(It.IsAny<DNS_Search>()))
.Returns((IList<DNSContract> records) => new List<DNSContract>
{
new DNSContract {FirstName …Run Code Online (Sandbox Code Playgroud) 我正在寻找我的构建来删除目录的内容而不触及某个文件夹.以下是我正在尝试的内容,它甚至对我来说都是错误的......除了它在我运行它时它会爆炸的事实.我是否需要明确删除目录的内容,同时排除我的报告文件夹?
<delete includeemptydirs="true">
<fileset dir="${PublishLocation}" >
<exclude name="**Reports**"/>
</fileset>
</delete>
Run Code Online (Sandbox Code Playgroud)
干杯.
我有一个非常简单的场景,其中有一组记录可用,我需要在一个简单的ng-repeat中显示它们.但是我需要按属性分组的记录,我的目标不是不必更改集合以完成此分组.我的想法是可以应用某种类型的过滤器,但在实践中过滤器,过滤器,数据并不要分组.有没有办法有一个集合,只是分组和重复?
真正的hack-ish jsFiddle与我正在尝试做的事情在这里.
http://jsfiddle.net/bryangrimes/RufQh/5/
简而言之,这个想法是这样的:
<ul>
<li ng-repeat="log in logs grouped by log.dept">
<h4>{{log.dept}}</h4>
{{log.name}} worked {{log.hours}} this week
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
更新:所以最后我们已经使用taffyDB来存放原始数据集,所以这只是扩展了.
$.each($scope.logs, function() {
var log = $(this)[0];
// build angular friendly data structure
log.workLogsDB = TAFFY(log.worklogs);
log.deptLogs = [];
$.each(log.workLogsDB().distinct('department').sort(), function() {
var dept = $(this)[0].toString();
var cost = log.workLogsDB({department:dept}).sum('cost');
var hours = log.workLogsDB({department:dept}).sum('hours');
var items = log.workLogsDB({department:dept}).get();
log.deptLogs.push({
department: dept,
total_cost: cost,
total_hours: hours,
line_items: items
});
});
});
Run Code Online (Sandbox Code Playgroud)
和要呈现的HTML:
<div ng-repeat="log in logs">
<h3 onclick="$('#{{log.project}}').slideDown()">
{{log.project}} …Run Code Online (Sandbox Code Playgroud) 我有一个主要数据的字典(大致)如下: {'UID': 'A12B4', 'name': 'John', 'email': 'hi@example.com}
我还有另一个词典: {'UID': 'A12B4', 'other_thing: 'cats'}
我不清楚如何"加入"这两个词,然后把"other_thing"放到主要词典中.我需要的是:{'UID': 'A12B4', 'name': 'John', 'email': 'hi@example.com, 'other_thing': 'cats'}
我对这样的理解很新,但我的直觉说必须有一种直截了当的方式.
我正在寻找一种简洁的方法来获取具有共同键/值的两个dicts,并将键和值复制到其中一个dicts中.例:
d1 = [{'name': 'john', 'uid': 'ax01', 'phone': '555-555-5555'},
{'name': 'jane', 'uid': 'ax02', 'phone': '555-555-5555'},
{'name': 'jimmy', 'uid': 'ax03', 'phone': '555-555-5555'}]
d2 = [{'uid': 'ax01', 'orderid': '9999', 'note': 'testing this'},
{'uid': 'ax02', 'orderid': '6666', 'note': 'testing this'},
{'uid': 'ax03', 'orderid': '7777', 'note': 'testing this'}]
Run Code Online (Sandbox Code Playgroud)
这uid是我想要用来复制orderid密钥和该匹配数据点的值的密钥.最后我会得到类似的东西:
output = [
{'name': 'john', 'uid': 'ax01', 'phone': '555-555-5555', 'orderid': '9999'},
{'name': 'jane', 'uid': 'ax02', 'phone': '555-555-5555', 'orderid': '6666'},
{'name': 'jimmy', 'uid': 'ax03', 'phone': '555-555-5555', 'orderid': '7777'}
]
Run Code Online (Sandbox Code Playgroud)
凡orderid被拉入 …
dictionary ×2
python ×2
unit-testing ×2
angularjs ×1
c# ×1
moq ×1
nant ×1
nunit ×1
taffydb ×1
testing ×1