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

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

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

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

            var entity = new Clasp();

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

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

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