public async void InsertAccountAsync() { var newItem = GF.New <Account>(); newItem.Type = "DataAccessLayerBase"; using (var dbConnection = new SqlConnection(_connectionString)) { var items = (await _dbContext.GetAccountsAsync(dbConnection)).ToList(); newItem.Name = $"{newItem.Name} ({items.Count})"; } using (var dbConnection = new SqlConnection(_connectionString)) { await dbConnection.OpenAsync(); using (var dbTransaction = dbConnection.BeginTransaction()) { try { var result = await _dbContext.InsertAccountAsync(dbTransaction, newItem); dbTransaction.Commit(); Assert.NotEqual(0, result); } catch { dbTransaction.Rollback(); throw; } } } }
public async void InsertAccountAsync_Customer() { _logger.LogInformation("InsertAccountAsync_Customer"); var newItem = GF.New <CustomerAccount>(); newItem.Type = "Customer"; newItem.Name = $"{newItem.Name} ({Guid.NewGuid()})"; using (var dbTransaction = await DbConnectionFactory.BeginTransactionAsync()) { try { var result = await _repository.InsertAccountAsync(dbTransaction, newItem); dbTransaction.Commit(); //Assert.NotNull(result); Assert.NotEqual(0, result); } catch { dbTransaction.Rollback(); throw; } } }
public void Serialize_TestModel() { _logger.LogInformation("Serialize_TestModel"); var item = GF.New <TestAccount>(); var result = _objectDocumentSerializer.Serialize <RepoModels.Account, DalModels.Account>(item); Assert.NotNull(result); Assert.NotEqual("{}", result.ObjectDocument); }
public void Deserialize_AsRepositoryModel() { _logger.LogInformation("Deserialize_AsRepositoryModel"); var item = GF.New <DalModels.Account>(); item.ObjectDocument = @" { ""Property00"": ""cleanse"", ""Property10"": 97, ""Property20"": 27.27, ""Property30"": ""2005-08-21T05:25:58"" } "; var result = _objectDocumentSerializer.Deserialize <DalModels.Account, RepoModels.Account>(item); Assert.NotNull(result); }
public void Deserialize_AsTestModel() { _logger.LogInformation("Deserialize_AsTestModel"); var item = GF.New <DalModels.Account>(); item.ObjectDocument = @" { ""Property00"": ""cleanse"", ""Property10"": 97, ""Property20"": 27.27, ""Property30"": ""2005-08-21T05:25:58"" } "; var result = _objectDocumentSerializer.Deserialize <DalModels.Account, TestAccount>(item); Assert.NotNull(result); Assert.Equal("cleanse", result.Property00); Assert.Equal(97, result.Property10); Assert.Equal(27.27m, result.Property20); Assert.Equal(DateTime.Parse("2005-08-21T05:25:58"), result.Property30); }