我正在尝试使用Android构建的Gradle的FindBugs插件.
该build.gradle文件
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
apply plugin: 'findbugs'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
Run Code Online (Sandbox Code Playgroud)
但是,当我执行check任务时,它说
No classes configured for FindBugs analysis.
如何为FindBugs分析配置类?
我正在为MVC 5 Web应用程序编写单元测试.我HttpContext.Current从我的测试中嘲笑过.当运行以下代码形成测试httpSessionStateAfter抛出时
System.AggregateException:发生一个或多个错误.
----> System.NullReferenceException:对象引用未设置为对象的实例.
只有在我运行单元测试时才会发生这种情况.当应用程序运行此工作正常.我正在使用Nunit 2.6.3和reshaper测试运行器.
var httpSessionStateBefour = System.Web.HttpContext.Current.Session;
var Person= await Db.Persons.FirstOrDefaultAsync();
var httpSessionStateAfter = System.Web.HttpContext.Current.Session;
Run Code Online (Sandbox Code Playgroud)
怎么过来这个问题?
这就是我嘲笑HttpContext的方式
HttpContext.Current = Fakes.FakeHttpContext();
HttpContext.Current.Session.Add("IsUserSiteAdmin", true);
HttpContext.Current.Session.Add("CurrentSite", null);
public static class Fakes
{
public static HttpContext FakeHttpContext()
{
var httpRequest = new HttpRequest("", "http://stackoverflow/", "");
var stringWriter = new StringWriter();
var httpResponce = new HttpResponse(stringWriter);
var httpContext = new HttpContext(httpRequest, httpResponce);
var sessionContainer = new HttpSessionStateContainer("id", new SessionStateItemCollection(),
new HttpStaticObjectsCollection(), 10, true,
HttpCookieMode.AutoDetect,
SessionStateMode.InProc, false); …Run Code Online (Sandbox Code Playgroud) 如何在jQuery中获取基本URL?
想想我在http:// localhost/test/test_controller/test的js文件中然后我只想获得
/test
Run Code Online (Sandbox Code Playgroud)
要么
http://localhost/test/
Run Code Online (Sandbox Code Playgroud) android ×1
asp.net-mvc ×1
async-await ×1
c# ×1
findbugs ×1
gradle ×1
javascript ×1
jquery ×1
unit-testing ×1