방금 WP7 응용 프로그램을 테스트하기 시작했으며 WP7에서 비동기 메서드를 테스트하는 데 문제가 있습니다.WP7의 단위 테스트 비동기 메서드에서 Enqueue ... 메서드를 인식하지 못했습니다.
다음 게시물 : http://www.codeproject.com/Articles/158531/The-Unit-Test-of-Silverlight-Applications-with-Asy I 필기 시험 클래스와 구현 시험 방법 : 내가 프로젝트를 빌드 할 때
[TestMethod]
[Asynchronous]
public void AsynchronousWCFCallWithGetStudentWCFCommand()
{
MainPageViewModel vm = new MainPageViewModel();
bool done = false;
vm.AsyncCallbackCompleted += (() => done = true);
EnqueueCallback(() => vm.GetStudentWCFCommand.Execute(null));
EnqueueConditional(() => done);
EnqueueCallback(() => Assert.IsNotNull(vm.StudentList,
"No student retrieved from the WCF service"));
EnqueueCallback(() => Assert.IsTrue(vm.StudentList.Count == 10,
"The number of the students should be 10."));
EnqueueTestComplete();
}
그러나, VS2010 같이 나에게 오류를 제공 인큐 방법 중 하나를 인식하지 않습니다는 " name 'EnqueueTestComplete'이 (가) 현재 컨텍스트에 존재하지 않습니다. "
제프 윌콕스 웹 사이트의 http://www.jeff.wilcox.name/2010/05/sl3-utf-bits/ 바이너리를 테스트 프로젝트에 추가했습니다. 테스트 클래스에서는 다음 두 문장을 사용합니다.
using Microsoft.Silverlight.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
무엇이 누락 되었습니까? 내 문제를 밝힐 수 있니?
SilverlightTest 클래스를 상속하는 것을 잊지 않았습니까? –
나는 명백한 것을 놓친다는 것을 알았지 만 나는 그런 나빴던 날을 보내고 있다고 생각하지 않았다. 이것을 지적 해 주셔서 감사합니다. 모든 것이 잘 작동합니다. – anetafr