/// <summary> /// Creates a intitial Dataset for the Testmethods /// </summary> /// <param name="dbContext">Datacontext</param> /// <param name="user">User which owns the dataset</param> /// <param name="flags">Flags for the dataset</param> /// <returns>intial dataset</returns> private Dataset CreateInitialXorDataset(DataContext dbContext, User user, DataSetFlags flags) { Dataset xorDataset = new Dataset() { Data = File.ReadAllText("Resources/xor.json"), Flags = flags, UserId = user.Id, Name = "XOR" }; dbContext.Datasets.Add(xorDataset); dbContext.SaveChanges(); return(xorDataset); }
private Dataset xorDataset = null; //cache private DatasetDto GetXorDatasetDto(DataSetFlags flags) { if (xorDataset == null) { xorDataset = new Dataset() { Data = File.ReadAllText("Resources/xor_ok.json"), Flags = flags, UserId = 0, Name = "XOR" }; } return(DatasetMapper.ToDto(xorDataset)); }