我正在尝试在单击按钮时更新按钮的文本.我有许多具有相同类但没有id的按钮.为什么这不起作用?
<input type="button" class="add-button" value="Default" />
<input type="button" class="add-button" value="Default" />
<input type="button" class="add-button" value="Default" />
<input type="button" class="add-button" value="Default" />
$(document).ready(function() {
$('.add-button').click(function() {
alert('clicked');
$(this).html('Changed');
});
});?
Run Code Online (Sandbox Code Playgroud)
警报已触发,但按钮未更改.
我试图将日期字符串解析为java.util.Date使用java.text.SimpleDateFormat; 但是,生成的格式化日期是错误的.
这是一个显示问题的测试用例:
@Test
public void testSimpleDateFormat() throws Exception {
String dateString = "2016-03-03 11:50:39.5960000";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSSS");
Date date = format.parse(dateString);
assertEquals(dateString, format.format(date));
}
Run Code Online (Sandbox Code Playgroud)
这导致以下失败:
org.junit.ComparisonFailure:
Expected :2016-03-03 11:50:39.5960000
Actual :2016-03-03 13:29:59.0000000
Run Code Online (Sandbox Code Playgroud)
日期是正确的,但小时,分钟,秒和毫秒都是错误的.为什么java.text.SimpleDateFormat搞砸我约会的时间?
我试图模拟我的存储库的Get()方法返回一个对象,以伪造该对象的更新,但我的设置不起作用:
这是我的测试:
[Test]
public void TestUploadDealSummaryReportUploadedExistingUpdatesSuccessfully()
{
var dealSummary = new DealSummary {FileName = "Test"};
_mockRepository.Setup(r => r.Get(x => x.FileName == dealSummary.FileName))
.Returns(new DealSummary {FileName = "Test"}); //not working for some reason...
var reportUploader = new ReportUploader(_mockUnitOfWork.Object, _mockRepository.Object);
reportUploader.UploadDealSummaryReport(dealSummary, "", "");
_mockRepository.Verify(r => r.Update(dealSummary));
_mockUnitOfWork.Verify(uow => uow.Save());
}
Run Code Online (Sandbox Code Playgroud)
以下是正在测试的方法:
public void UploadDealSummaryReport(DealSummary dealSummary, string uploadedBy, string comments)
{
dealSummary.UploadedBy = uploadedBy;
dealSummary.Comments = comments;
// method should be mocked to return a deal summary but returns null
var existingDealSummary = …Run Code Online (Sandbox Code Playgroud) 我正在研究一个类的项目,可能是我们必须实现一个简单调度程序的WORST指令..虽然C编程不是课程的先决条件,这是调度程序的语言,我不一定是C语言程序员..
无论如何,我试图通过打印任务来调试它,以便我可以通过程序跟踪它,但我不断收到以下编译时错误:
schedule.c:61:48:error:解除引用不完整类型的指针
这是task_struct定义:
struct task_struct
{
struct thread_info *thread_info;
int prio, static_prio, normal_prio;
unsigned long sleep_avg;
unsigned long long last_ran;
unsigned long long timestamp;
unsigned long long sched_time;
unsigned int time_slice, first_time_slice;
struct list_head run_list;
struct sched_array *array;
enum sleep_type sleep_type;
int need_reschedule;
};
Run Code Online (Sandbox Code Playgroud)
我试图在里面调试的功能:
void initschedule(struct runqueue *newrq, struct task_struct *seedTask)
{
printf("Inside initschedule()\n");
printf("%s - TEST \n", (seedTask)->thread_info->processName); //causes compiler error
/* initialize runqueue and current task */
rq = newrq;
current = NULL;
/* …Run Code Online (Sandbox Code Playgroud) c ×1
date ×1
html ×1
java ×1
javascript ×1
jquery ×1
linux ×1
mocking ×1
moq ×1
nunit ×1
scheduling ×1
unit-testing ×1