Exemple #1
0
        public async Task <Guid> AddTestCase(TestCaseRequest testCaseRequest)
        {
            if (testCaseRequest.AccountId == null)
            {
                throw new ArgumentNullException(nameof(testCaseRequest.AccountId));
            }

            var testCase = new DataTestCaseRequest()
            {
                AccountId = testCaseRequest.AccountId,
                Title     = testCaseRequest.Title
            };

            var id = await _dataTestCaseService.AddTestCase(testCase);

            return(Guid.Parse(id));
        }
Exemple #2
0
        public async Task <string> AddTestCase(DataTestCaseRequest testCaseRequest)
        {
            var testCase = new TestCasesDto()
            {
                AccountId = AccountId,
                Id        = Guid.NewGuid().ToString(),
                Title     = testCaseRequest.Title
            };

            var user = await new DataAccountsService(AccountId).GetAccountById(testCase.AccountId);

            if (user == null)
            {
                throw new KeyNotFoundException("AccountId does not exist");
            }

            await DynamoDbContextProvider.CurrentContext.SaveAsync <TestCasesDto>(testCase);

            return(testCase.Id);
        }
        public async Task AddTestCase()
        {
            var client = new DataClient("664ca358-3ae8-4d79-9554-682d21a01467").TestCases();

            var testCase = new DataTestCaseRequest()
            {
                Title = "Our First TestCase"
            };

            var id = client.AddTestCase(testCase).Result;

            var returnedTestCase = client.GetTestCase(id).Result;

            Assert.AreEqual(client.AccountId.ToString(), returnedTestCase.AccountId);
            Assert.AreEqual(testCase.Title.ToString(), returnedTestCase.Title);

            await client.DeleteTestCase(id).ConfigureAwait(false);

            Thread.Sleep(1000);

            var deletedTestCase = client.GetTestCase(id).Result;

            Assert.IsNull(deletedTestCase);
        }