Esempio n. 1
0
        public async void Create()
        {
            Mock <ILogger <TeamRepository> > loggerMoc = TeamRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext             context   = TeamRepositoryMoc.GetContext();
            var repository = new TeamRepository(loggerMoc.Object, context);

            var entity = new Team();
            await repository.Create(entity);

            var record = await context.Set <Team>().FirstOrDefaultAsync();

            record.Should().NotBeNull();
        }
Esempio n. 2
0
        public async void Create()
        {
            Mock <ILogger <TeamRepository> > loggerMoc = TeamRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext             context   = TeamRepositoryMoc.GetContext();
            var repository = new TeamRepository(loggerMoc.Object, context);

            var entity = new Team();

            entity.SetProperties(default(int), "B", 1);
            await repository.Create(entity);

            var records = await context.Set <Team>().ToListAsync();

            records.Count.Should().Be(2);
        }