??????????????????
???????????? ???????[ 2013/4/28 10:17:24 ] ????????
?????????????????????????????????????????????????????????????????????в????????????????????????????????????????????У????Assert?????????ж????????????????????????????????????????????????????????????????????????????????????????????????ж??????????????????????????????????????????????????????????????????????????????excel????洢????????????????
??????????????μ???????н????????н2000?????????????10???????????????????1000?????????0.05??????????1000??????2000?????????0.10??????2000???????0.15???????????????????????????????????????????????£?
namespace CalculateSalaryProject
{
public class Program
{
public double GetTotalSalaryBySales(int sales)
{
const double BaseSalary = 2000;
double unitPrice = 10;
double royaltyRate = 0.0;
if (sales <= 0)
{
royaltyRate = 0.0;
}
else if (sales <= 1000)
{
royaltyRate = 0.05;
}
else if (sales <= 2000)
{
royaltyRate = 0.10;
}
else
{
royaltyRate = 0.15;
}
return BaseSalary + unitPrice * sales * royaltyRate;
}
} }
????????????????????????е?????????£?
using CalculateSalaryProject;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestProject
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void GetSalaryBySalesUnitTest()
{
Program program = new Program();
double actualSalary = program.GetTotalSalaryBySales(1);
double expectedSalary = 2000.5;
Assert.AreEqual(expectedSalary?? actualSalary);
}
}
}
?????ò???????????????1???????????????????????????????????????????-1??0??1??999??1000??1001??1999??2000??2001??????????????????????????????Щ?????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11