Esempio n. 1
0
        public async Task UpdateColumnAsync(int Id, Column column)
        {
            var updatedColumn = new DAL.Column {
                Id = Id, Title = column.Title
            };
            var entry = _context.Columns.Attach(updatedColumn);

            entry.State = EntityState.Modified;
            await _context.SaveChangesAsync();
        }
Esempio n. 2
0
        public async Task GetColumnsWithData()
        {
            using (var testScope = TestWebAppFactory.Create())
            {
                testScope.AddSeedEntities(TestColumns);

                var client   = testScope.CreateClient();
                var response = await client.GetAsync("/api/columns");

                response.EnsureSuccessStatusCode();
                var actual = await response.Content.ReadFromJsonAsync <BLL.Column[]>();

                DAL.Column[] actualEntities = new DAL.Column[TestColumns.Length];
                for (int i = 0; i < TestColumns.Length; i++)
                {
                    actualEntities[i] = MapDtoToEntity(actual[i]);
                }

                Assert.IsNotNull(actual);
                CollectionAssert.AreEquivalent(TestColumns, actualEntities);
            }
        }
Esempio n. 3
0
 private static BLL.Column MapEntityToDto(DAL.Column entity)
 => new BLL.Column(entity.Id, entity.Title);