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.");
            }
  • 相关阅读:
    nano编辑器__vi常用命令
    pyCharm最新2018激活方式(记录)
    一、centos7.4安装docker
    C#备份及还原数据库的实现
    System.Drawing.image 与ImageSource 互转
    Socket 异步通信
    图片与base64的互转
    程序中编写log日志
    SQLHelper
    Cond
  • 原文地址:https://www.cnblogs.com/solo/p/1552695.html
Copyright © 2011-2022 走看看