使用同一数据库中的代码,表单和数据,我想知道为Microsoft Access应用程序设计一套测试的最佳实践是什么(比如Access 2007).
测试表单的主要问题之一是,只有少数控件具有hwnd句柄,而其他控件只能获得一个焦点,这使得自动化非常不透明,因为您无法获取表单上的控件列表.
有经验可以分享吗?
在WPF中,我可以添加任何UI到ListBoxItem通过提供的S ListBox有ItemTemplate:
<ListBox ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" BorderBrush="Gray" CornerRadius="8" Padding="4,0,4,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<CheckBox Grid.Column="1" Content="Is Active Customer" IsChecked="{Binding IsActive}"/>
<Label Content="Id:" Grid.Row="1" HorizontalAlignment="Right"/>
<Label Content="Name:" Grid.Row="2" HorizontalAlignment="Right"/>
<TextBox Text="{Binding Id}" Grid.Row="1" Grid.Column="1"/>
<TextBox Text="{Binding Name}" Grid.Row="2" Grid.Column="1"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
结果是:

有没有办法在Windows窗体中实现相同的功能?
编辑:
1 -有什么办法,以实现在Windows窗体一样,同时保持separation of concerns之间View和Application Logic以这样的方式,如果我后来想完全重新定义View,我就不必重构整个应用程序?
2 - winforms是否支持数据绑定,使得我的每一个ListBoxItems都可以绑定到一个复杂的Entity,最终包括从Model数据到UI数据的中间类型转换,然后返回,这样我就不必写入大量的样板代码填充视图,然后将UI值传回模型以便保存? …
.net ×1
c# ×1
database ×1
listbox ×1
listboxitem ×1
ms-access ×1
unit-testing ×1
vba ×1
winforms ×1