草庐IT

completed_tests

全部标签

c# - 单元测试 Asp.Net WebApi : how to test correct routing of a method with [FromUri] parameters

我想测试这个Controller:[HttpGet]publicIListGetNotificationsByCustomerAndId([FromUri]string[]name,[FromUri]int[]lastNotificationID){return_storage.GetNotifications(name,lastNotificationID,_topX);}特别是,在此方法中,我想测试传入输入以形成请求Url的数组是否与进入routeData.Values的数组相同。如果对于单值参数(不是数组)它有效,但不适用于数组。如果我调试Values,我只会看到controll

JavaScript 样式/优化 : String. indexOf() v. Regex.test()

我最近遇到了这段JavaScript代码:if(",>=,,".indexOf(","+sCompOp+",")!=-1)我很感兴趣,因为要编写这个测试我会这样做:if(/(>=|)/.test(sCompOp))这只是风格上的差异,还是其他代码的作者了解一些我不知道的优化知识?或者也许有不同的充分理由这样做,或者不使用正则表达式......?在我看来,为此使用String.indexOf()有点难以阅读(但是,我对正则表达式很满意),但是有没有实例可能比编写等效的正则表达式“更好”?通过可能更快或更有效的“更好”(尽管显然这取决于浏览器的JavaScript引擎)或其他一些我不知道的

java: 无法访问org.testng.annotations.Test

目录一、报错 二、原因三、解决办法一、报错java:无法访问org.testng.annotations.Test 错误的类文件:/D:/maven_repository/org/testng/testng/7.6.1/testng-7.6.1.jar!/org/testng/annotations/Test.class  类文件具有错误的版本55.0,应为52.0  请删除该文件或确保该文件位于正确的类路径子目录中。 二、原因testing版本过高导致三、解决办法换一个低版本testing(大家使用最多即可)官方Maven地址:https://mvnrepository.com/artifa

javascript - jquery 完整日历 : callback 'after' the calendar has loaded completely

AdamShaw的jqueryfullcalendar中是否有在日历完全呈现后调用的回调?我想在该回调中调用clientEvents函数以获取客户端的所有事件。我尝试在viewDisplay中执行此操作,但在呈现事件之前调用它并且clientEvents返回0个事件。 最佳答案 我知道这篇文章现在已经很老了,但如果有任何帮助,您不需要按照Cheery的建议修改原始来源(尽管他/她的回答也可以正常工作)。您也可以只使用已经存在的回调“loading”:$('#calendar').fullCalendar({loading:funct

javascript - Angular Testing 异步管道不会触发可观察的

我想测试一个使用异步管道的组件。这是我的代码:@Component({selector:'test',template:`{{number|async}}`})classAsyncComponent{number=Observable.interval(1000).take(3)}fdescribe('AsyncCompnent',()=>{letcomponent:AsyncComponent;letfixture:ComponentFixture;beforeEach(async(()=>{TestBed.configureTestingModule({declarations:[

javascript - Rails + Jasmine-Ajax : what is the correct way to test code triggered by `ajax:success` (jquery-ujs)

我正在尝试测试某个内部库,该库在ajax:success事件上触发了一些JS行为。库创建一个如下所示的链接:在库的JS部分有事件绑定(bind)代码,这是我想通过它对DOM的影响进行黑盒测试的部分:$(document).on'ajax:success','.special-link',(e,data,status,xhr)->#CodethathassomeeffectontheDOMasafunctionoftheserverresponse该库在浏览器中按预期工作。但是,当我尝试通过调用$('.special-link').click()测试Jasmine中的库时,无法观察到对D

javascript - react 和 Jest : Cannot find module from test file

为目录中的Redux操作('App.js')设置Jest测试('App-test.js')app/__tests__:这是App.js的header:jest.unmock('../../modules/actions/App.js')importReactfrom'react'importReactDOMfrom'react-dom'importTestUtilsfrom'react-addons-test-utils'import*asAppfrom'../../modules/actions/App.js'在app/有一个模块config.js.这是在需要的地方导入的。问题是,当

javascript - 动态创建脚本 : readyState never "complete"

我正在尝试在脚本完全加载后执行某些操作。(IE8)我用于测试的脚本:http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js无效的:http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.minaaaaaaaa.js代码...varscript=createtheelementandappendtohead...//thisworksfinewithFF/Chrome/...script.onload=function(){alert('scriptloadi

javascript - Backbone Marionette : Defer view close until beforeClose animation is complete

我正在尝试使用Backbone.Marionette在渲染和关闭ItemView时设置动画。对于渲染View,这是相当简单的:MyItemView=Backbone.Marionette.View.extend({...onRender:function(){this.$el.hide().fadeIn();}...});这将使我的View在渲染时淡入。但是假设我想在关闭时淡出我的观点。beforeClose:function(){this.$el.fadeOut();//doesn'tdoanything....}这是行不通的,因为该项目在调用this.beforeClose()后立

javascript - Protractor 和 Angular : How to test two pages in an app, 一个接一个?

我想在我的Angular应用程序的两个单独页面上运行Protractor测试:/dashboard和/articles。复杂的是我必须手动登录应用程序。目前我有这个设置:varLoginPage=function(){ptor=protractor.getInstance();this.login=function(url){ptor.get(url);ptor.findElement(protractor.By.model('email')).sendKeys(config.LOGIN_EMAIL);ptor.findElement(protractor.By.model('pass