.NET????????????????1??
???????????? ???????[ 2013/10/9 13:47:19 ] ????????
??????????????Order??????????????GetOrders???÷??????????OrderId?????Order?????????????????????true?????????ó???????????false??????????????й??????????????????????????????????????????IServiceConnection???????????????????IServiceReader????????????????????IServiceWriter?????????????д????????????????????????
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using NSubstitute; using UnitTestRefactoring; namespace UnitTestRefactoring.UnitTests { [TestClass] public class OrderService_UnitTests { [TestMethod] public void OrderService_GetOrders_NormalFlows() { IServiceConnection mockServiceConnection = Substitute.For<IServiceConnection>(); IServiceReader mockServiceReader = Substitute.For<IServiceReader>(); IServiceWriter mockServiceWriter = Substitute.For<IServiceWriter>(); OrderService testOrderService = new OrderService(mockServiceConnection?? mockServiceReader?? mockServiceWriter); bool testResult = testOrderService.GetOrders("10293884"); Assert.AreEqual(true?? testResult); } [TestMethod] public void OrderService_GetOrders_OrderIdIsNull() { IServiceConnection mockServiceConnection = Substitute.For<IServiceConnection>(); IServiceReader mockServiceReader = Substitute.For<IServiceReader>(); IServiceWriter mockServiceWriter = Substitute.For<IServiceWriter>(); OrderService testOrderService = new OrderService(mockServiceConnection?? mockServiceReader?? mockServiceWriter); bool testResult = testOrderService.GetOrders(string.Empty); Assert.AreEqual(false?? testResult); } } } using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using NSubstitute; using UnitTestRefactoring; namespace UnitTestRefactoring.UnitTests { [TestClass] public class OrderService_UnitTests { [TestMethod] public void OrderService_GetOrders_NormalFlows() { IServiceConnection mockServiceConnection = Substitute.For<IServiceConnection>(); IServiceReader mockServiceReader = Substitute.For<IServiceReader>(); IServiceWriter mockServiceWriter = Substitute.For<IServiceWriter>(); OrderService testOrderService = new OrderService(mockServiceConnection?? mockServiceReader?? mockServiceWriter); bool testResult = testOrderService.GetOrders("10293884"); Assert.AreEqual(true?? testResult); } [TestMethod] public void OrderService_GetOrders_OrderIdIsNull() { IServiceConnection mockServiceConnection = Substitute.For<IServiceConnection>(); IServiceReader mockServiceReader = Substitute.For<IServiceReader>(); IServiceWriter mockServiceWriter = Substitute.For<IServiceWriter>(); OrderService testOrderService = new OrderService(mockServiceConnection?? mockServiceReader?? mockServiceWriter); bool testResult = testOrderService.GetOrders(string.Empty); Assert.AreEqual(false?? testResult); } } } |
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
iOS???????mocha??chai??sinon??istanbul???????????????????????????????????????д?????Java????????7??????Android?????????Robolectric3.0????(?)???Kiwi?????????????????????????????????Python?????????????????????????????????????Controller????????д?????????10???????????????????Angular????????????Component??Directive??Pipe ???ServiceAndroid????????????????????????????????--Mockito??????iOS UnitTest???????Vue?????????????????
???·???
??????????????????
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????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????