public void Insert_AppName_Is_Successful() { //Arrange TResult <ResponseAppNameCreate> expectedResponse = new TResult <ResponseAppNameCreate> { Data = new ResponseAppNameCreate { IsSuccessful = true, AppID = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6" }, Rtncode = FaultInfoRcConstants.OK, RtnMsg = "Test AppName" }; _appListService.AppNameIsExisted(_request.AppName).Returns(false); _appListService.GetIsTopAppList().Returns(_inSideOrOutSideApp); _appListService.InsertAppName(Arg.Any <WisAppList>(), Arg.Any <List <WisAppUserList> >()).Returns(true); _appListService.GetDefineGroup(Arg.Any <List <string> >()).Returns(new List <WisDefineGroup>()); //Act TResult <ResponseAppNameCreate> actualResponse = _targetObj.InsertAppName(_request); //Assert Assert.AreEqual(expectedResponse.Rtncode, actualResponse.Rtncode); Assert.AreEqual(expectedResponse.RtnMsg, actualResponse.RtnMsg); Assert.AreEqual(expectedResponse.Data.IsSuccessful, actualResponse.Data.IsSuccessful); }
public void Test_InsertAppName() { //Arrange WisAppList wisAppList = new WisAppList { AppID = "TESTAPPID", AppName = "TEST", Development = "TEST", LastUpdateUser = "", LastUpdateDT = DateTime.Now, CreateDT = DateTime.Now, CompanyApp = true, }; List <WisAppUserList> wisAppUserList = new List <WisAppUserList> { new WisAppUserList { AppID = "TESTAPPID", UserID = "TESTUSERID" } }; //Act _targetObj.InsertAppName(wisAppList, wisAppUserList); IConnectionProvider connectionProvider = new SqlConnectionProvider(_configContext.McpDb); //做完後必須刪除假資料 using (McpDataBaseRepository mcpDataBaseRepository = new McpDataBaseRepository(connectionProvider)) { mcpDataBaseRepository.WisAppListTable.Delete("TESTAPPID"); mcpDataBaseRepository.WisAppUserListTable.DeleteByAppID("TESTAPPID"); mcpDataBaseRepository.Commit(); } }