public void ShouldAssignDataContextWithProvidedItem() { CategoryContainer container = new CategoryContainer(); GridEntry item = new GridEntryMock(); new CategoryItemsLayoutMock().CallPrepareContainerForItemOverride(container, item); Assert.AreEqual(item, container.DataContext); }
public void ShouldAssignBindingWithProvidedItem() { CategoryContainer container = new CategoryContainer(); GridEntry item = new GridEntryMock(); new CategoryItemsLayoutMock().CallPrepareContainerForItemOverride(container, item); var expression = container.GetBindingExpression(GridEntryContainer.EntryProperty); Assert.IsNotNull(expression); }
public void ShouldReturnEditorWithDataTemplate() { DataTemplate template = new DataTemplate(); GridEntryMock entry = new GridEntryMock { Editor = new EditorMock { InlineTemplate = template } }; GridEntryContainerMock container = new GridEntryContainerMock { Entry = entry }; Assert.AreEqual <DataTemplate>(template, container.EditorTemplate); }
public void ShouldReturnNothingForWrongComponentKey() { ComponentResourceKey key = new ComponentResourceKey(); ResourceLocatorMock resourceLocator = new ResourceLocatorMock(key, null); GridEntryMock entry = new GridEntryMock { Editor = new EditorMock { InlineTemplate = key } }; GridEntryContainerMock container = new GridEntryContainerMock(resourceLocator) { Entry = entry }; Assert.IsNull(container.EditorTemplate); }
public void ShouldReturnEditorWithComponentResourceKey() { ComponentResourceKey key = new ComponentResourceKey(); DataTemplate template = new DataTemplate(); ResourceLocatorMock resourceLocator = new ResourceLocatorMock(key, template); GridEntryMock entry = new GridEntryMock { Editor = new EditorMock { InlineTemplate = key } }; GridEntryContainerMock container = new GridEntryContainerMock(resourceLocator) { Entry = entry }; Assert.AreEqual(template, container.EditorTemplate); }