1
저는 주니어 개발자이며 아직 회사의 코드베이스를 연구 중입니다.
는 여기가 hasProductImages
설정을 테스트 유닛 생성 된 코드입니다,하지만 난 오류 ...단위 테스트의 System.ArgumentNullException
System.ArgumentNullException에 봉착 : 값은 null 일 수 없습니다.
... 마지막 코드에서 무엇이 문제 일 수 있습니까?
[TestClass]
public class ChooseProductViewModelTest
{
ChooseProductViewModel chooseProduct;
private EventAggregatorMock eventAggregator;
private ProductRepositoryMock productRepository;
private CategoryRepositoryMock categoryRepository;
private PosDeviceSettingsMock posDeviceSettings;
[TestInitialize]
public void Init()
{
eventAggregator = new EventAggregatorMock();
productRepository = new ProductRepositoryMock();
categoryRepository = new CategoryRepositoryMock();
posDeviceSettings = new PosDeviceSettingsMock();
chooseProduct = new ChooseProductViewModel(productRepository, categoryRepository, eventAggregator, posDeviceSettings);
}
[TestMethod]
public void ProductImageConfiguration_Verification_With_ProductItemViewModel()
{
chooseProduct = new ChooseProductViewModel(productRepository, categoryRepository, eventAggregator, posDeviceSettings);
Assert.IsTrue((chooseProduct.Items.First() as ProductItemViewModel).hasProductImages);
}
}
감사를 반환 이유를 조사 시작하지만 내 문제를 해결 didnt는, 어쩌면 내가 그것을 물론 니코 – Reaper
감사합니다, 를 null를 돌려 왜 더 조사해야 ChooseProductViewModel에 대한 코드를 제공하지 않았으므로 우리가 할 수있는 것은 추측입니다. 항목 열거 형의 첫 번째 항목이 실제로 ProfuctItemViewModel 유형인지 또는 'choseProduct.Items.OfType().'로 다시 작성되는지 확인하십시오. First()' –
metacircle
감사합니다. – Reaper