我正在开发一个存储在SVN中的项目.该项目依赖于第三方DLL,因此需要引用该DLL.
存储此DLL的最佳位置在哪里,以便从SVN打开项目的任何人都可以编译它?
我有以下泛型类
public class Home<T> where T : Class
{
public string GetClassType
{
get{ return T.ToString() }
}
}
Run Code Online (Sandbox Code Playgroud)
现在,我得到一个对象X,我肯定知道它是Home:
public void DoSomething(object x)
{
if(x is // Check if Home<>)
{
// I want to invoke GetClassType method of x
// but I don't know his generic type
x as Home<?> // What should I use here?
}
}
Run Code Online (Sandbox Code Playgroud)
我是否可以在不指定类的泛型类型的情况下进行转换?
我有以下课程:
public class HelperClass
{
HandleFunction<T>(Func<T> func)
{
// Custom logic here
func.Invoke();
// Custom logic here
}
// The class i want to test
public class MainClass
{
public readonly HelperClass _helper;
// Ctor
MainClass(HelperClass helper)
{
_helper = helper;
}
public void Foo()
{
// Use the handle method
_helper.HandleFunction(() =>
{
// Foo logic here:
Action1();
Action2(); //etc..
}
}
}
Run Code Online (Sandbox Code Playgroud)
我只想测试MainClass.我HelperClass在测试中使用RhinoMocks进行模拟.
问题是,虽然我不感兴趣测试HandleFunction()我感兴趣的方法Action1,Action2以及HandleFunction()调用时发送的其他操作.
我如何模拟HandleFunction() …
我有一个使用另一个函数输出的函数:一个ActiveRecord :: Relation对象.这个关系已经有一个订单条款:
# This function cannot be changed
def black_box
Product.where('...').order("name")
end
def my_func
black_box.order("id")
end
Run Code Online (Sandbox Code Playgroud)
当我执行关系时,订单函数对ORDER_BY子句进行排序:
SELECT * FROM products
WHERE ...
ORDER_BY('name', 'id') // The first order function, then the second
Run Code Online (Sandbox Code Playgroud)
有没有什么方法可以指定在前一个之前插入我的订单功能的关系?那么SQL会是这样的吗?
SELECT * FROM products
WHERE ...
ORDER_BY('id', 'name')
Run Code Online (Sandbox Code Playgroud) 我正在使用TeamCity Professional来不断地构建和测试我的代码.
我有一些基于MSTest的测试在我的PC上在VS2010中正常工作但在构建服务器上失败了.
我悄悄地发现,经过测试,TeamCity在其中创建了一个临时目录TEMP_DIR(可配置),并仅将"第一关系"依赖项复制到测试DLL.
例如:我的测试使用NHibernate.dll哪个被复制到临时目录但其依赖项(即NHibernate.ByteCode.Castle)没有被复制,并且测试失败并出现IO.FileNotFound异常.
有什么办法可以从测试项目输出目录(Test/bin/debug)运行测试吗?
如果没有,我如何指定应该将哪些DLL复制到临时目录?
c# teamcity continuous-integration mstest visual-studio-2010
c# ×4
.net ×1
activerecord ×1
casting ×1
dll ×1
generics ×1
mstest ×1
reference ×1
rhino-mocks ×1
teamcity ×1
unit-testing ×1