This project is read-only.
1
Vote

STAFact Attribut can not be resolved

description

Hi

I try to write a unit test, which needs to create a WPF control.
The tests fails with the error "Thread must be a STA-Tread".

I tried to add the [STAFact] attribute to the testmethod, but VisualStudio complains:
"The type or namespace name 'STAFact' could not be found ..."

My test looks like:
using Xunit;

public class The_JobSelectionModule
{
    [STAFact]
    public void WhenInitializeIsCalledThenViewsAndViewModelsAreRegistered()
    {
        // Arrange
        var container = GetPreparedContainer();
        var sut = GetSut(container);

        // Act  
        sut.Initialize();
        var viewModel = container.Resolve<IWorkflowJobSelectionViewModel>();
        var view = container.Resolve<WorkflowJobSelectionView>();

        // Assert
        Assert.NotNull(view);
        Assert.NotNull(viewModel);
    }
}
What is it I am doing wrong?

Regards
Rainer

comments