コード例 #1
0
        public async Task Get_GetsApiKeysList(ApiKeySyncanoClient client)
        {
            //when
            var result = await client.Get();

            //then
            result.ShouldNotBeNull();
            result.Count.ShouldEqual(2);
            result.Any(a => a.ApiKeyValue == TestData.BackendAdminApiKey).ShouldBeTrue();
        }
コード例 #2
0
        public async Task New_WithRoleIdAndUserType_ThrowsException(ApiKeySyncanoClient client)
        {
            try
            {
                //when
                await client.New("description", ApiKeyType.User, TestData.RoleId);

                throw new Exception("New should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType <ArgumentException>();
            }
        }
コード例 #3
0
        public async Task New_WithInvalidRoleId_ThrowsException(ApiKeySyncanoClient client)
        {
            try
            {
                //when
                await client.New("description", ApiKeyType.Backend, "9999");

                throw new Exception("New should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType <SyncanoException>();
            }
        }
コード例 #4
0
        public async Task New_WithNullDescription_ThrowsException(ApiKeySyncanoClient client)
        {
            try
            {
                //when
                await client.New(null, roleId : TestData.RoleId);

                throw new Exception("New should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType <ArgumentNullException>();
            }
        }