using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestRefactoring.UnitTests
{
[TestClass]
public class OrderService_UnitTests : ServiceBaseUnitTestClass
{
[TestMethod]
public void OrderService_GetOrders_NormalFlows()
{
OrderService testOrderService = new OrderService(mockServiceConnection?? mockServiceReader?? mockServiceWriter);
bool testResult = testOrderService.GetOrders("10293884");
Assert.AreEqual(true?? testResult);
}
[TestMethod]
public void OrderService_GetOrders_OrderIdIsNull()
{
OrderService testOrderService = new OrderService(mockServiceConnection?? mockServiceReader?? mockServiceWriter);
bool testResult = testOrderService.GetOrders(string.Empty);
Assert.AreEqual(false?? testResult);
}
}
}

????OrderService_UnitTests ??
?????????????????????????????????????а???????????????????????????????????????????????????????????????????в???????????????????????????????????????Service???????????и?Order??????????????????????????????????????????У?
????2.1.2???????Mock???
???????2.1.1??С?????????Mock??????????????????????????????1???Mock?????????????????????IServiceConnection??????????????Open????????????????????

 

namespace UnitTestRefactoring
{
public interface IServiceConnection
{
bool Open();
}
}
namespace UnitTestRefactoring
{
public interface IServiceConnection
{
bool Open();
}
}