这个错误有点难以描述,但我会尽力描述序列。
答案 0 :(得分:0)
好的,我已经尝试过并且无法重新审核您的问题。根据您的描述:
我的测试如下所示(和通过)。
test("query nav prop change and expand", function() {
var em1 = newEm();
var em2 = newEm();
var p = Predicate.create("freight", ">", 100).and("customerID", "!=", null);
var query = new breeze.EntityQuery()
.from("Orders")
.where(p)
.expand("customer")
.take(1);
stop();
var oldCust, newCust1a, newCust1b, order1, order1a, order1b;
em1.executeQuery(query).then(function(data) {
order1 = data.results[0];
oldCust = order1.customer;
ok(oldCust != null, "oldCust should not be null");
return em2.executeQuery(EntityQuery.fromEntityKey(order1.entityAspect.getKey()));
}).then(function(data2) {
order1a = data2.results[0];
ok(order1.entityAspect.getKey().equals(order1a.entityAspect.getKey()), "order keys should be the same");
var customerType = em2.metadataStore.getEntityType("Customer");
newCust1a = customerType.createEntity();
newCust1a.setProperty("companyName", "Test_compName");
order1a.setProperty("customer", newCust1a);
return em2.saveChanges();
}).then(function (sr) {
em1.entityChanged.subscribe(function(args) {
var entity = args.entity;
ok(entity != null, "entity should not be null");
ok(entity.entityAspect.entityState != EntityState.Detached, "entityState should not be detached");
});
return em1.executeQuery(query);
}).then(function(data3) {
order1b = data3.results[0];
ok(order1b == order1, "should be the same order");
newCust1b = order1b.customer;
ok(newCust1a.entityAspect.getKey().equals(newCust1b.entityAspect.getKey()), "customer keys should be the same");
ok(newCust1b != null, "newCust1b should not be null");
ok(newCust1b.entityAspect.entityState.isUnchanged(), "should be unchanged");
}).fail(testFns.handleFail).fin(start);
});
此时我真的需要一个复制品才能继续前进。请使用Breeze zip中的DocCode示例(单元测试的集合)创建一个破解单元测试用例并将其发布到此处。