コード例 #1
0
        public void DeleteTest()
        {
            var account      = TestHelper.GetTestAccount();
            var user         = TestHelper.GetAccountAdminUser(account.Id);
            var component    = account.CreateTestApplicationComponent();
            var unitTestType = TestHelper.CreateTestUnitTestType(account.Id);
            var service      = DispatcherHelper.GetDispatcherService();

            // Создадим проверку
            var request = new GetOrCreateUnitTestRequest()
            {
                Token = account.GetCoreToken(),
                Data  = new GetOrCreateUnitTestRequestData()
                {
                    DisplayName    = "Новый юнит-тест " + DateTime.Now.Ticks,
                    SystemName     = "Test.UnitTestType " + DateTime.Now.Ticks,
                    ComponentId    = component.Id,
                    UnitTestTypeId = unitTestType.Id
                }
            };
            var response = service.GetOrCreateUnitTest(request);

            Assert.True(response.Success);
            var unitTestId = response.Data.Id;

            // Проверим, что проверка есть в списке
            using (var controller = new UnitTestsController(account.Id, user.Id))
            {
                var result    = (ViewResultBase)controller.Index();
                var listModel = (UnitTestsListModel)result.Model;
                Assert.True(listModel.UnitTestTypes.Any(t => t.UnitTests.Any(x => x.Id == unitTestId)));
            }

            // Удалим проверку
            using (var controller = new UnitTestsController(account.Id, user.Id))
            {
                controller.Delete(unitTestId, "fake");
            }
            account.SaveAllCaches();

            // Проверим, что проверки нет в списке
            using (var controller = new UnitTestsController(account.Id, user.Id))
            {
                var result    = (ViewResultBase)controller.Index();
                var listModel = (UnitTestsListModel)result.Model;
                Assert.False(listModel.UnitTestTypes.Any(t => t.UnitTests.Any(x => x.Id == unitTestId)));
            }
        }
コード例 #2
0
 public GetOrCreateUnitTestResponse GetOrCreateUnitTest(GetOrCreateUnitTestRequest request)
 {
     return(ExecuteAction <GetOrCreateUnitTestResponse>(request));
 }
コード例 #3
0
 public GetOrCreateUnitTestResponse GetOrCreateUnitTest(GetOrCreateUnitTestRequest request)
 {
     return(Execute(() => InternalService.GetOrCreateUnitTest(request)));
 }