public async Task SetUp() { VaultConfig config = new VaultConfig(); config.Host = "localhost:8082"; config.Scheme = "http"; config.Path = "api/v1"; config.Token = $"bearer {TestContext.Parameters["token"]}"; _vaultService = new VaultService( config, new TestLogManager(LogLevel.Trace) ); provide.Model.Vault.Vault vault = new provide.Model.Vault.Vault(); vault.Name = "Name"; vault.Description = "Description"; // Create a single Vault instance provide.Model.Vault.Vault response = await _vaultService.CreateVault(vault); response.Id.Should().NotBeNull(); _vaultId = response.Id !.Value; _wallet = new VaultWallet(_vaultService, _vaultId.ToString(), LimboLogs.Instance); }
public async Task <ActionResult <Vault> > CreateVault([FromBody] Vault newVault) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVault.Creator = userInfo; newVault.CreatorId = userInfo.Id; Vault created = _vs.CreateVault(newVault); Profile userProfile = _ps.GetOrCreateProfile(userInfo); _ps.updateVaultCount(userProfile); return(Ok(created)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }