or
public interface IViewModel
{
string DisplayName { get; }
Brush BackgroundBrush { get; }
}
<
UserControl
x:Class
=
"View"
[...]>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"{Binding Path=BackgroundBrush}"
>
<
Border
BorderBrush
=
"Black"
BorderThickness
=
"1"
>
<
TextBlock
Text
=
"{Binding Path=DisplayName}"
/>
</
Border
>
</
Grid
>
</
UserControl
>
[TestMethod]
[Asynchronous]
public
void
BindingTest_BackgroundBrushIsSet()
{
var target =
new
View();
var datacontextMock = Mock.Create<IViewModel>();
var expectedBackground =
new
SolidColorBrush(Colors.Purple);
target.DataContext = datacontextMock;
Mock.Arrange(() => datacontextMock.BackgroundBrush).Returns(expectedBackground);
Mock.Arrange(() => datacontextMock.DisplayName).Returns(
string
.Empty);
AsyncWaitForFrameworkElementLoaded(target);
AssertCallback
(() =>
{
var layoutRoot = target.FindName<Grid>(
"LayoutRoot"
);
Assert.AreEqual(expectedBackground, layoutRoot.Background);
});
}
internal
Priority(Int32 priorityId, String name, Int32 rank, Int32 expirationBuffer, Boolean isLiveMicrophone, Boolean isEmergency, Boolean isRepeated, Int32 repeatBuffer, Single levelAdjustment, Boolean isInterruptible, Int32 percentAvailable)
Mock.Arrange(() => Dvams.Priority.GetAll()).Returns(
new
Dvams.PriorityList());
var p = Dvams.Priority.GetAll();
.NET Runtime version 4.0.30319.296 - The profiler was loaded successfully. Profiler CLSID: '{b7abe522-a68f-44f2-925b-81e7488e9ec0}'. Process ID (decimal): 4288. Message ID: [0x2507].
Any ideas whats going wrong?
Thanks, Tobias