Ejemplo n.º 1
0
        public void Is_AllAssets_NotDeleted()
        {
            var lists        = _watchListService.GetAllAsync(ClientId).Result;
            var allAsstsList = lists.FirstOrDefault(item => item.Name == "All assets");

            Assert.IsNotNull(allAsstsList);

            var result = _watchListService.DeleteAsync(ClientId, allAsstsList.Id).Result;

            Assert.AreEqual(WatchListStatus.ReadOnly, result.Status);
            Assert.IsFalse(result.Result);

            lists        = _watchListService.GetAllAsync(ClientId).Result;
            allAsstsList = lists.FirstOrDefault(item => item.Name == "All assets");

            Assert.IsNotNull(allAsstsList);
        }
Ejemplo n.º 2
0
        public async Task <ResponseModel> DeleteWatchList(string id)
        {
            var clientId = User.GetClaim(ClaimTypes.NameIdentifier);

            if (clientId == null)
            {
                return(ResponseModel <List <MarginTradingWatchList> > .CreateFail(ResponseModel.ErrorCodeType.NoAccess, "Wrong token"));
            }

            var result = await _watchListService.DeleteAsync(clientId, id);

            switch (result.Status)
            {
            case WatchListStatus.NotFound:
                return(ResponseModel.CreateFail(ResponseModel.ErrorCodeType.NoData, "Watch list not found"));

            case WatchListStatus.ReadOnly:
                return(ResponseModel.CreateFail(ResponseModel.ErrorCodeType.InconsistentData, "Readonly watch list can't be deleted"));
            }

            return(ResponseModel.CreateOk());
        }