Example #1
0
        public async void Create()
        {
            Mock <ILogger <PetRepository> > loggerMoc = PetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext            context   = PetRepositoryMoc.GetContext();
            var repository = new PetRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
Example #2
0
        public async void Create()
        {
            Mock <ILogger <PetRepository> > loggerMoc = PetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext            context   = PetRepositoryMoc.GetContext();
            var repository = new PetRepository(loggerMoc.Object, context);

            var entity = new Pet();

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

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

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