Пример #1
0
        public void InsertData()
        {
            var teste = Teste.Factory();

            using (var provider = MySqlDataProviderFactory.Factory())
            {
                using (var dataset = provider.GetDataSet <Teste>())
                {
                    dataset.Append(new List <Teste>()
                    {
                        teste
                    });
                }
            }
        }
Пример #2
0
        public void DeleteData()
        {
            var teste = Teste.Factory();

            using (var provider = MySqlDataProviderFactory.Factory())
            {
                using (var dataset = provider.GetDataSet <Teste>())
                {
                    dataset.Append(new List <Teste>()
                    {
                        teste
                    });
                    var result = dataset.DeleteRecords(t => t.Id == teste.Id);

                    Assert.Equal(1, result);
                }
            }
        }
Пример #3
0
        public void CountData()
        {
            var teste = Teste.Factory();

            using (var provider = MySqlDataProviderFactory.Factory())
            {
                using (var dataset = provider.GetDataSet <Teste>())
                {
                    dataset.Append(new List <Teste>()
                    {
                        teste
                    });

                    teste.Name = Guid.NewGuid().ToString();

                    var result = dataset.Count(t => t.Id == teste.Id);

                    Assert.Equal(1, result);
                }
            }
        }
Пример #4
0
        public void GetRecord()
        {
            var teste = Teste.Factory();

            using (var provider = MySqlDataProviderFactory.Factory())
            {
                using (var dataset = provider.GetDataSet <Teste>())
                {
                    dataset.Append(new List <Teste>()
                    {
                        teste
                    });

                    teste.Name = "Update record";

                    var records = dataset.GetEntities(t => t.Id == teste.Id);

                    Assert.Single(records);
                }
            }
        }
Пример #5
0
        public void UpdateData()
        {
            var teste = Teste.Factory();

            using (var provider = MongoDataProviderFactory.Factory())
            {
                using (var dataset = provider.GetDataSet <Teste>())
                {
                    dataset.Append(new List <Teste>()
                    {
                        teste
                    });

                    teste.Name = Guid.NewGuid().ToString();

                    var result = dataset.UpdateRecords(t => t.Id == teste.Id, teste);

                    Assert.Equal(1, result);
                }
            }
        }
Пример #6
0
        public void GetData(int limit)
        {
            var teste = Teste.Factory();

            using (var provider = MySqlDataProviderFactory.Factory())
            {
                using (var dataset = provider.GetDataSet <Teste>())
                {
                    dataset.Append(new List <Teste>()
                    {
                        teste
                    });

                    teste.Name = "Update record";

                    var result  = dataset.UpdateRecords(t => t.Id == teste.Id, teste);
                    var records = dataset.GetEntities(e => e.Name == teste.Name, limit);

                    Assert.Equal(1, result);
                    Assert.Equal(limit, records.Count());
                }
            }
        }