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

            var entity = new Rate();

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

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

            records.Count.Should().Be(2);
        }
Ejemplo n.º 2
0
        public async void Get()
        {
            Mock <ILogger <RateRepository> > loggerMoc = RateRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext             context   = RateRepositoryMoc.GetContext();
            var repository = new RateRepository(loggerMoc.Object, context);

            Rate entity = new Rate();

            entity.SetProperties(default(int), 2m, 1, 1);
            context.Set <Rate>().Add(entity);
            await context.SaveChangesAsync();

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

            record.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <RateRepository> > loggerMoc = RateRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext             context   = RateRepositoryMoc.GetContext();
            var  repository = new RateRepository(loggerMoc.Object, context);
            Rate entity     = new Rate();

            entity.SetProperties(default(int), 2m, 1, 1);
            context.Set <Rate>().Add(entity);
            await context.SaveChangesAsync();

            context.Entry(entity).State = EntityState.Detached;

            await repository.Update(entity);

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

            records.Count.Should().Be(2);
        }
Ejemplo n.º 4
0
        public async void Migrate()
        {
            var adminItem1 = new Admin();

            adminItem1.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", 1, "A", "A", 1);
            this.context.Admins.Add(adminItem1);

            var eventItem1 = new Event();

            eventItem1.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A");
            this.context.Events.Add(eventItem1);

            var eventStatusItem1 = new EventStatus();

            eventStatusItem1.SetProperties(1, "A");
            this.context.EventStatuses.Add(eventStatusItem1);

            var familyItem1 = new Family();

            familyItem1.SetProperties(1, "A", "A", "A", "A", "A");
            this.context.Families.Add(familyItem1);

            var rateItem1 = new Rate();

            rateItem1.SetProperties(1m, 1, 1, 1);
            this.context.Rates.Add(rateItem1);

            var spaceItem1 = new Space();

            spaceItem1.SetProperties("A", 1, "A");
            this.context.Spaces.Add(spaceItem1);

            var spaceFeatureItem1 = new SpaceFeature();

            spaceFeatureItem1.SetProperties(1, "A");
            this.context.SpaceFeatures.Add(spaceFeatureItem1);

            var studentItem1 = new Student();

            studentItem1.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", true, 1, "A", 1, true, "A", "A", true, 1);
            this.context.Students.Add(studentItem1);

            var studioItem1 = new Studio();

            studioItem1.SetProperties("A", "A", "A", 1, "A", "A", "A", "A");
            this.context.Studios.Add(studioItem1);

            var teacherItem1 = new Teacher();

            teacherItem1.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", 1, "A", "A", 1);
            this.context.Teachers.Add(teacherItem1);

            var teacherSkillItem1 = new TeacherSkill();

            teacherSkillItem1.SetProperties(1, "A");
            this.context.TeacherSkills.Add(teacherSkillItem1);

            var tenantItem1 = new Tenant();

            tenantItem1.SetProperties(1, "A");
            this.context.Tenants.Add(tenantItem1);

            var userItem1 = new User();

            userItem1.SetProperties(1, "A", "A");
            this.context.Users.Add(userItem1);

            var vEventItem1 = new VEvent();

            vEventItem1.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"));
            this.context.VEvents.Add(vEventItem1);

            await this.context.SaveChangesAsync();
        }