public void AddAccount(NewAccount newAccount) { Requires(newAccount != null, "Nueva cuenta invalida"); Requires(!string.IsNullOrWhiteSpace(newAccount.Code), "Codigo de nueva cuenta invalido"); Requires(!_accountDataByCode.ContainsKey(newAccount.Code), "Codigo de cuenta ya esta en uso"); Requires(!_accountBalanceByCode.ContainsKey(newAccount.Code), "Codigo de cuenta ya esta en uso"); Ensures(_accountDataByCode.ContainsKey(newAccount.Code)); Ensures(_accountBalanceByCode.ContainsKey(newAccount.Code)); var accountData = new AccountData(); accountData.Code = newAccount.Code; accountData.Name = newAccount.Name; accountData.Nature = newAccount.Nature; _accountDataByCode.Add(accountData.Code, accountData); _accountBalanceByCode.Add(accountData.Code, newAccount.InitialBalance); }