小编kuh*_*yan的帖子

WPF验证中ValidatesOnNotifyDataErrors和ValidatesOnDataErrors与NotifyOnValidationError有什么区别?

WPF验证中,有以下几点之间的区别:

ValidatesOnNotifyDataErrors = True

ValidatesOnDataErrors = True

NotifyOnValidationError = True

什么时候应该在XAML中正确使用这些属性?

validation wpf xaml

48
推荐指数
2
解决办法
2万
查看次数

找不到具有不变名称"System.Data.SqlServerCe.4.0"的ADO.NET提供程序的实体框架提供程序

当我使用sqlce 4.0 with entityframework 6.0时出现以下错误

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'
Run Code Online (Sandbox Code Playgroud)

我的app.config看起来像这样

....
<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false" />
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
 <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" >
      <parameters>
        <parameter value =" System.Data.SqlServerCe.4.0" />
      </parameters>
    </defaultConnectionFactory>
    <!--providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers-->
  </entityFramework>
  <connectionStrings> …
Run Code Online (Sandbox Code Playgroud)

entity-framework sql-server-ce c#-4.0

35
推荐指数
4
解决办法
5万
查看次数

Mockito - 参数匹配器的使用无效

我有测试jms消息发送的Junit测试.我使用Spring jmsTemplate来做到这一点.在这里,我在下面的代码中,我想检查JMS模板是否已调用发送消息,无论它传递的actuall参数的值是什么.

我的发布者方法使用jmsTemplate发送方法看起来像跟在里面..

jmsTemplate.send(jmsQueueProperties.getProperty(key), new MessageCreator()
{
    public Message createMessage(Session session) throws JMSException
    {
        ObjectMessage obj = session.createObjectMessage(dialogueServiceResponse);
        return obj;
}
});
Run Code Online (Sandbox Code Playgroud)

在我的测试..

JmsTemplate mockTemplate = Mockito.mock(JmsTemplate.class);
...
publisher.publishServiceMessage(response);
....
Mockito.verify(mockTemplate, 
    Mockito.times(1)).send("appointment.queue", 
        Mockito.any(MessageCreator.class));
Run Code Online (Sandbox Code Playgroud)

但是当我执行时,我得到了

org.mockito.exceptions.misusing.InvalidUseOfMatchersException:参数匹配器的使用无效!....

原因是由于Mockito.any(MessageCreator.class),但是没有办法测试我的send方法是在没有在MessageCreator中创建实际对象的情况下执行的.

更新 有没有办法检查我的session.createObjectMessage(dialogueServiceResponse)也被调用

junit unit-testing mockito

33
推荐指数
2
解决办法
6万
查看次数

是否可以验证在Mockito中以不同线程运行的模拟方法?

我有一个像下面这样的方法,

public void generateCSVFile(final Date billingDate) {
    asyncTaskExecutor.execute(new Runnable() {
        public void run() {
            try {
                accessService.generateCSVFile(billingDate);
            } catch (Exception e) {
                LOG.error(e.getMessage());
            }
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

我嘲笑:

PowerMockito.doNothing().when(accessService).generateCSVFile(billingDate);
Run Code Online (Sandbox Code Playgroud)

但是当我验证时:

verify(rbmPublicViewAccessService, timeout(100).times(1)).generateCSVFile(billingDate);
Run Code Online (Sandbox Code Playgroud)

它给了我没有被调用.这是因为它是通过单独的线程调用的,是否可以验证在不同线程中调用的方法?

java mocking mockito powermock

19
推荐指数
2
解决办法
2万
查看次数

如何捕获URL参数 - Magento

我有以下要求:我的网址可以是以下任何一种

我想捕获resid值并将其放在后端并按照客户的顺序保存.

即,如果?resid=133被请求并且客户稍后继续进行订单,我希望将resid其与订单ID(例如100000123)一起保存(133).

后来我希望resid价值显示在销售订单网格中(在管理员中).

有人可以指导我这样做吗?

magento

15
推荐指数
2
解决办法
6万
查看次数

我可以在Visual Studio中仅跟踪我的TODO任务吗?

有没有办法只能在Visual Studio中过滤掉自己的TODO任务?

目前有几个开发人员正在工作,他们添加了自己的TODO.最后,如果我查看我的任务列表,列出了很多TODO,我几乎无法弄清楚哪些是我的.

我尝试搜索一些VS网站,但没有找到任何有用的信息.如何仅过滤我自己的TODO,或者至少过滤了我所触及的文件中的所有TODO?我正在使用VS 2010.

visual-studio-2010 visual-studio

9
推荐指数
1
解决办法
1481
查看次数

什么是骡子的入站终点和出站终点?

我一直试图弄清楚究竟什么是入站终点和出站终点.对我而言,理解是有点躲避.

什么是mule流中/ do的入站和出站端点?如果流程想要发送消息,则应在接收时使用哪个端点.或者当一个应用程序想要调用一个它应该与之通信的端点的流?

esb mule mule-studio

8
推荐指数
2
解决办法
5020
查看次数

如何在Maven中跳过生成源

有没有办法跳过Maven中的generate-sources?

通过命令行选项进行操作

java build maven

5
推荐指数
1
解决办法
6600
查看次数

ASP.net喜欢WPF MVVM prism中基于表单的身份验证

在开发WPF MVVM(prism)应用程序之后,我想实现身份验证,就像基于ASP.NET表单的身份验证一样.我想限制用户进入需要授权的屏幕.如何在WPF应用程序中实现,因为我正在使用PRISM.

authentication wpf mvvm prism-4

4
推荐指数
1
解决办法
688
查看次数

如何获得今天在火鸟YYYYMMDD的日期

今天如何在火鸟的YYYYMMDD中获取日期,我看了下面但是无法想出怎么写这个.

sql firebird firebird2.5

1
推荐指数
2
解决办法
3万
查看次数

JMS测试 - JMSTemplate发送未执行

我有代码片段通过Spring JMSTemplate发送jms消息.为了测试方法我使用Mockito.

我的代码如下所示.... publishDialogueServiceMessage() - >

 brokerUrl = jmsQueueProperties.getProperty(MessageRouterConstants.JMS_QUEUE_URL);  
        LOG.info("The broker url is : {}", brokerUrl);  
        jmsTemplate.send(jmsQueueProperties.getProperty(MessageRouterConstants.QUEUE), new MessageCreator() {

            @Override
            public Message createMessage(Session session) throws JMSException {             
                ObjectMessage obj = session.createObjectMessage(serviceResponse);
                messageSent = true;
                return obj;
            }
        });
Run Code Online (Sandbox Code Playgroud)

在上面的代码我设置布尔变量true,检查是否发送了消息

我的测试看起来如下,

@Before
    public void setUp() throws Exception {

        connectionFactory = Mockito.spy(new ActiveMQConnectionFactory(
                "vm://localhost?broker.persistent=false"));
        conn = connectionFactory.createConnection();
        conn.start();       
    } 

@After
public void cleanUp() throws Exception{
    conn.stop();
}
Run Code Online (Sandbox Code Playgroud)


@Test
    public void testPublishDialogueServiceMessage()
    {
        ServiceResponse response = Mockito.mock(
                ServiceResponse.class, Mockito.withSettings()
                        .serializable());
        JmsTemplate mockTemplate …
Run Code Online (Sandbox Code Playgroud)

junit unit-testing jms mockito spring-jms

0
推荐指数
1
解决办法
6435
查看次数