public void GetById_ClubExist_ReturnClub() { var club = ModelSetup.SetupClubWithNoPeople(); var result = GetResult <Club>("/api/club/" + club.Id); result.Id.ShouldBe(club.Id); }
public void GetById_ClubExist_ReturnOk() { var club = ModelSetup.SetupClubWithNoPeople(); var response = GetResponse("/api/club/" + club.Id); response.StatusCode.ShouldBe(HttpStatusCode.OK); }
public void GetPeople_ClubExistWithPeople_ReturnsList() { var club = ModelSetup.SetupClubWithPeople(); var result = GetResult <List <Person> >("/api/club/" + club.Id + "/people"); result.Count.ShouldBeGreaterThanOrEqualTo(1); }
public void GetPeople_ClubExistNoPeople_ReturnsList() { var club = ModelSetup.SetupClubWithNoPeople(); var result = GetResult <Person>("/api/club/" + club.Id + "/people"); result.ShouldBeNull(); }
public void Update_ValidUpdate_Return200() { var club = ModelSetup.SetupClubWithNoPeople(); var response = PutResponse("/api/club", club); response.StatusCode.ShouldBe(HttpStatusCode.OK); }
public void Setup() { var mappingSet = ModelSetup.SetupModel(); database = mappingSet.Database; table = database.Tables[0]; index = new Index("index1"); table.AddIndex(index); }
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(); }
public void Setup() { mappingSet = ModelSetup.SetupModel(); entitySet = mappingSet.EntitySet; db = mappingSet.Database; table1 = db.Tables[0]; table2 = db.Tables[1]; table1.CreateRelationshipTo(table2); }
public void Update_IdNotFound_Return204() { var club = ModelSetup.SetupClubWithNoPeople(); club.Id = 1; var response = PutResponse("/api/club", club); response.StatusCode.ShouldBe(HttpStatusCode.NoContent); }
public void Update_InvalidModel_Return400() { var club = ModelSetup.SetupClubWithNoPeople(); club.NafaClubNumber = -1; var response = PutResponse("/api/club", club); response.StatusCode.ShouldBe(HttpStatusCode.BadRequest); }
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); }
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; } }
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); }
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(); }
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(); }