• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

Visual Studio 2008单元测试实践

发布: 2009-5-21 09:25 | 作者: 网络转载 | 来源: 测试时代采编 | 查看: 332次 | 进入软件测试论坛讨论

领测软件测试网

 


Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->using BankAccountDemo.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace BankAccountDemo.Business.Tests
...{
    [TestClass()]
    
public class BankAccountTest
    ...{
        
private TestContext testContextInstance;
        
public TestContext TestContext
        ...{
            
get
            ...{
                
return testContextInstance;
            }
            
set
            ...{
                testContextInstance
= value;
            }
        }
        Additional test attributes
#region Additional test attributes
        
#endregion
        [TestMethod()]
        
public void CurrentBalanceTest()
        ...{
            
float initialBalance = 0F; // TODO: Initialize to an appropriate value
            BankAccount target = new BankAccount(initialBalance); // TODO: Initialize to an appropriate value
            float expected = 0F; // TODO: Initialize to an appropriate value
            float actual;
            target.CurrentBalance
= expected;
            actual
= target.CurrentBalance;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive(
"Verify the correctness of this test method.");
        }
        [TestMethod()]
        
public void makePaymentTest()
        ...{
            
float initialBalance = 0F; // TODO: Initialize to an appropriate value
            BankAccount target = new BankAccount(initialBalance); // TODO: Initialize to an appropriate value
            float paymentAmount = 0F; // TODO: Initialize to an appropriate value
            target.makePayment(paymentAmount);
            Assert.Inconclusive(
"A method that does not return a value cannot be verified.");
        }
        [TestMethod()]
        
public void depositMoneyTest()
        ...{
            
float initialBalance = 0F; // TODO: Initialize to an appropriate value
            BankAccount target = new BankAccount(initialBalance); // TODO: Initialize to an appropriate value
            float depositAmount = 0F; // TODO: Initialize to an appropriate value
            target.depositMoney(depositAmount);
            Assert.Inconclusive(
"A method that does not return a value cannot be verified.");
        }
[TestMethod()]
        
public void BankAccountConstructorTest()
        ...{
            
float initialBalance = 0F; // TODO: Initialize to an appropriate value
            BankAccount target = new BankAccount(initialBalance);
            Assert.Inconclusive(
"TODO: Implement code to verify target");
        }
    }
}

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/

33/3<123

关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网