Ejemplo n.º 1
0
        public async void Get()
        {
            Mock <ILogger <EmailAddressRepository> > loggerMoc = EmailAddressRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = EmailAddressRepositoryMoc.GetContext();
            var repository = new EmailAddressRepository(loggerMoc.Object, context);

            EmailAddress entity = new EmailAddress();

            context.Set <EmailAddress>().Add(entity);
            await context.SaveChangesAsync();

            var record = await repository.Get(entity.BusinessEntityID);

            record.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <EmailAddressRepository> > loggerMoc = EmailAddressRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = EmailAddressRepositoryMoc.GetContext();
            var          repository      = new EmailAddressRepository(loggerMoc.Object, context);
            EmailAddress entity          = new EmailAddress();

            context.Set <EmailAddress>().Add(entity);
            await context.SaveChangesAsync();

            var record = await repository.Get(entity.BusinessEntityID);

            await repository.Update(record);

            var modifiedRecord = context.Set <EmailAddress>().FirstOrDefaultAsync();

            modifiedRecord.Should().NotBeNull();
        }