예제 #1
0
        public void GetById_ClubExist_ReturnClub()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var result = GetResult <Club>("/api/club/" + club.Id);

            result.Id.ShouldBe(club.Id);
        }
예제 #2
0
        public void GetById_ClubExist_ReturnOk()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var response = GetResponse("/api/club/" + club.Id);

            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        }
예제 #3
0
        public void GetPeople_ClubExistWithPeople_ReturnsList()
        {
            var club = ModelSetup.SetupClubWithPeople();

            var result = GetResult <List <Person> >("/api/club/" + club.Id + "/people");

            result.Count.ShouldBeGreaterThanOrEqualTo(1);
        }
예제 #4
0
        public void GetPeople_ClubExistNoPeople_ReturnsList()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var result = GetResult <Person>("/api/club/" + club.Id + "/people");

            result.ShouldBeNull();
        }
예제 #5
0
        public void Update_ValidUpdate_Return200()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            var response = PutResponse("/api/club", club);

            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        }
예제 #6
0
        public void Setup()
        {
            var mappingSet = ModelSetup.SetupModel();

            database = mappingSet.Database;
            table    = database.Tables[0];
            index    = new Index("index1");
            table.AddIndex(index);
        }
예제 #7
0
        public void Setup()
        {
            var mappingSet = ModelSetup.SetupModel();

            database     = mappingSet.Database;
            table        = database.Tables[0];
            relationship = table.Relationships[0];
            reference    = relationship.MappedReferences().First();
        }
        public void Setup()
        {
            var mappingSet = ModelSetup.SetupModel();
            var entitySet  = mappingSet.EntitySet;

            entity       = entitySet.Entities[0];
            reference    = entity.References[0];
            relationship = reference.MappedRelationship();
        }
예제 #9
0
        public void Setup()
        {
            mappingSet = ModelSetup.SetupModel();
            entitySet  = mappingSet.EntitySet;
            db         = mappingSet.Database;
            table1     = db.Tables[0];
            table2     = db.Tables[1];

            table1.CreateRelationshipTo(table2);
        }
예제 #10
0
        public void Update_IdNotFound_Return204()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            club.Id = 1;

            var response = PutResponse("/api/club", club);

            response.StatusCode.ShouldBe(HttpStatusCode.NoContent);
        }
예제 #11
0
        public void Update_InvalidModel_Return400()
        {
            var club = ModelSetup.SetupClubWithNoPeople();

            club.NafaClubNumber = -1;

            var response = PutResponse("/api/club", club);

            response.StatusCode.ShouldBe(HttpStatusCode.BadRequest);
        }
예제 #12
0
        public void Update_ValidUpdate_ReturnUpdateModel()
        {
            string newName = "Updated";

            var club = ModelSetup.SetupClubWithNoPeople();

            club.Name = newName;

            var result = PutResult <Club>("/api/club", club);

            result.Name.ShouldBe(newName);
        }
예제 #13
0
        public async Task GenerateStandardBlocks()
        {
            using var log = BeginFunction(nameof(DesignMicroService), nameof(GenerateStandardBlocks));
            try
            {
                await Task.CompletedTask;

                ModelSetup.CreateStandardResources(QuiltContextFactory);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }
예제 #14
0
        private static void CreateNewDatabase(IConfiguration configuration)
        {
            var options = new DatabaseOptions();

            configuration.GetSection(ConfigurationSectionNames.Application).Bind(options);

            var databaseName = string.Format("Quilt-{0:yyyy-MM-dd-HH-mm-ss}", DateTime.Now);

            options.LocalDatabaseName = databaseName;

            var fileName = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\SQL\\{options.LocalDatabaseName}.mdf";

            options.LocalConnectionString = $"Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog={options.LocalDatabaseName};AttachDbFilename={fileName};Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";

            var quiltContextFactory = QuiltContextFactory.Create(configuration, options);

            ModelSetup.CreateDatabase(quiltContextFactory);
        }
예제 #15
0
        public static void PopulateTestData(FlyballDbContext context)
        {
            Sheridan.Flyball.Data.EFCore.SeedData.PopulateData(context);
            context.Clubs.Add(ModelSetup.SetupClubWithPeople());
            context.Clubs.Add(ModelSetup.SetupClubWithNoPeople());

            var tournament = ModelSetup.KingsTournament;

            tournament.AddDivision(ModelSetup.Open1);
            tournament.AddDivision(ModelSetup.Open2);
            tournament.AddDivision(ModelSetup.Regular1);
            tournament.AddDivision(ModelSetup.Regular2);
            tournament.AddRaceYear(ModelSetup.CurrentRaceYear);

            tournament.AddRace(ModelSetup.Race1LeftSide);
            tournament.AddRace(ModelSetup.Race1RightSide);



            context.SaveChanges();
        }
예제 #16
0
        private static void CreateEntities(ServiceProvider serviceProvider)
        {
            IConfiguration             configuration       = serviceProvider.GetService <IConfiguration>();
            IQuiltContextFactory       quiltContextFactory = serviceProvider.GetService <IQuiltContextFactory>();
            UserManager <IdentityUser> userManager         = serviceProvider.GetService <UserManager <IdentityUser> >();
            RoleManager <IdentityRole> roleManager         = serviceProvider.GetService <RoleManager <IdentityRole> >();

            var task = Task.Run(async() =>
            {
                await ModelSetup.CreateStandardEntitiesAsync(
                    configuration,
                    quiltContextFactory,
                    userManager,
                    roleManager);

                await ModelTestSetup.CreateTestEntitiesAsync(
                    configuration,
                    quiltContextFactory,
                    DateTime.UtcNow,
                    DateTime.Now);
            });

            task.Wait();
        }