????????????????????????????????????????????????"??????????“????в??????????????????????????????????Ч??????????
???????????????????????????????????????塣
1 namespace OrderManager.Test
2 {
3     public abstract class ProductServiceIntegrationBase
4     {
5         /// <summary>
6         /// service address.
7         /// </summary>
8         protected const string ServiceAddressForDev = "http://dev.service.ProductService/";
9
10         /// <summary>
11         /// service address.
12         /// </summary>
13         protected const string ServiceAddressForPrd = "http://Prd.service.ProductService/";
14
15         /// <summary>
16         /// service address.
17         /// </summary>
18         protected const string ServiceAddressTest = "http://Test.service.ProductService/";
19     }
20 }
?????????????????????????????????????????
1 using System;
2 using Microsoft.VisualStudio.TestTools.UnitTesting;
3
4 namespace OrderManager.Test
5 {
6     using ProductService.Contract;
7
8     /// <summary>
9     /// Product service integration tests.
10     /// </summary>
11     [TestClass]
12     public class ProductServiceIntegrationTest : ProductServiceIntegrationBase
13     {
14         /// <summary>
15         /// product service client.
16         /// </summary>
17         private ProductServiceClient serviceInstance;
18
19         /// <summary>
20         /// Initialization test instance.
21         /// </summary>
22         [TestInitialize]
23         public void InitTestInstance()
24         {
25             serviceInstance = ProductServiceClient.CreateClient(ServiceAddressForDev/*for dev*/);
26         }
27
28         /// <summary>
29         /// Product service get product by pid test.
30         /// </summary>
31         [TestMethod]
32         public void ProductService_GetProductByPid_Test()
33         {
34             var testResult = serviceInstance.GetProductByPid(0393844);
35
36             Assert.AreNotEqual(testResult?? null);
37             Assert.AreEqual(testResult.Pid?? 0393844);
38         }
39
40         /// <summary>
41         /// Product service delete search index test.
42         /// </summary>
43         [TestMethod]
44         public void ProductService_DeleteProductSearchIndex_Test()
45         {
46             var testResult = serviceInstance.DeleteProductSearchIndex();
47
48             Assert.IsTrue(testResult);
49         }
50     }
51 }
??????????????????????????????????????????????????????????????????????????DeleteProductSearchIndex????????????????????????????????????????????????????????????DEV?????????У?????????????????????÷?????????????????????????????????????
????????????????????????????????????????????????????????????????????????????
???????????????????????????????
1 using System;
2 using Microsoft.VisualStudio.TestTools.UnitTesting;
3
4 namespace OrderManager.Test
5 {
6     using ProductService.Contract;
7
8     /// <summary>
9     /// Product service integration tests.
10     /// </summary>
11     [TestClass]
12     public class ProductServiceIntegrationTest : ProductServiceIntegrationBase
13     {
14         /// <summary>
15         /// product service client.
16         /// </summary>
17         private ProductServiceClient serviceInstance;
18
19         /// <summary>
20         /// Initialization test instance.
21         /// </summary>
22         [TestInitialize]
23         public void InitTestInstance()
24         {
25             serviceInstance = ProductServiceClient.CreateClient(ServiceAddressForPrd/*for dev*/);
26
27             this.CheckCurrentTestCaseIsRun(this.serviceInstance);//check current test case .
28         }
29
30         /// <summary>
31         /// Product service get product by pid test.
32         /// </summary>
33         [TestMethod]
34         public void ProductService_GetProductByPid_Test()
35         {
36             var testResult = serviceInstance.GetProductByPid(0393844);
37
38             Assert.AreNotEqual(testResult?? null);
39             Assert.AreEqual(testResult.Pid?? 0393844);
40         }
41
42         /// <summary>
43         /// Product service delete search index test.
44         /// </summary>
45         [TestMethod]
46         public void ProductService_DeleteProductSearchIndex_Test()
47         {
48             var testResult = serviceInstance.DeleteProductSearchIndex();
49
50             Assert.IsTrue(testResult);
51         }
52     }
53 }