Esempio n. 1
0
        public void Bug278()
        {
            using var _       = CreateDatabase278();
            using var context = new Bug278Context(_options);
            var actual = context.Entities.Select(x => new
            {
                Codes = x.ChannelCodes.Select(c => (ChannelCode)c)
            }).ToList()[0];

            Assert.Equal(new[] { ChannelCode.Code, ChannelCode.Code }, actual.Codes);
        }
        public void Bug278()
        {
            using (var testStore = NpgsqlTestStore.CreateScratch())
                using (var context = new Bug278Context(Fixture.CreateOptions(testStore)))
                {
                    context.Database.EnsureCreated();
                    context.Entities.Add(new Bug278Entity {
                        ChannelCodes = new[] { 1, 1 }
                    });
                    context.SaveChanges();

                    var actual = context.Entities.Select(x => new
                    {
                        Codes = x.ChannelCodes.Select(c => (ChannelCode)c)
                    }).ToList()[0];

                    Assert.Equal(new[] { ChannelCode.Code, ChannelCode.Code }, actual.Codes);
                }
        }
Esempio n. 3
0
        public async Task Bug278()
        {
            using (var testStore = NpgsqlTestStore.CreateScratch())
                using (var context = new Bug278Context(new DbContextOptionsBuilder()
                                                       .UseNpgsql(testStore.Connection)
                                                       .Options))
                {
                    context.Database.EnsureCreated();
                    context.Entities.Add(new Bug278Entity {
                        ChannelCodes = new[] { 1, 1 }
                    });
                    context.SaveChanges();

                    var actual = await context.Entities.Select(x => new
                    {
                        Codes = x.ChannelCodes.Select(c => (ChannelCode)c)
                    }).FirstOrDefaultAsync();

                    Assert.Equal(new[] { ChannelCode.Code, ChannelCode.Code }, actual.Codes);
                }
        }