zoukankan      html  css  js  c++  java
  • 使用Visual Studio创建WebService Unit Test

    1.使用Unit Test Wizard创建单元测试.不必说

    2.Copy WebService项目下面的Web.config到单元测试项目下,改名App.config,如有需要修改修改相应配置

    3.HostType 注释掉

    4.UrlToTest 修改为指定的webservice url

    如下:

            [TestMethod()]
           // [HostType("ASP.NET")] 注释掉
            [AspNetDevelopmentServerHost("E:\\Project\\Elp2.5\\source\\web\\ElpWeb\\ELPApp\\Elp.AppServices", "/")]
            [UrlToTest("http://localhost:3166/UserService.asmx")]//asmx地址
            public void LoginTest()
            {
                UserService target = new UserService(); // TODO: Initialize to an appropriate value
                string userName = "test"; // TODO: Initialize to an appropriate value
                string password = "edit"; // TODO: Initialize to an appropriate value
                bool actul=  target.Login(userName, password);
                Assert.AreEqual(true, actul);
    
               // Assert.Inconclusive("A method that does not return a value cannot be verified.");
            }
  • 相关阅读:
    OWIN系列之自己动手编写中间件
    Visual Studio2015使用tinyfox2.x作为Owin Host调试教程
    CentOS7下自定义目录安装mono+jexus教程
    TinyFox/Jexus如何正确使用配置文件
    CentOS7下默认目录安装mono+jexus教程
    CentOS 7 常用命令
    javascript动态创建script,并监听onload、onerror
    javascript if
    StackExchange.Redis常用API
    EF EntityState的几种状态
  • 原文地址:https://www.cnblogs.com/solo/p/1552695.html
Copyright © 2011-2022 走看看