public void AnnotateDeclarationRefactoring_InvalidTargetType_Throws() { const string code = @"Public Sub Foo() myLabel: Debug.Print ""Label""; End Sub"; Assert.Throws <InvalidDeclarationTypeException>(() => InitialModel( "myLabel", DeclarationType.LineLabel, ("TestModule", code, ComponentType.StandardModule))); }
public void AnnotateDeclarationRefactoring_InitialModel_ArgumentsEmpty() { const string code = @" Public Sub Foo() End Sub "; var model = InitialModel( "TestModule", DeclarationType.ProceduralModule, ("TestModule", code, ComponentType.StandardModule)); Assert.IsFalse(model.Arguments.Any()); }
public void AnnotateDeclarationRefactoring_InitialModel_TargetIsPassedInTarget() { const string code = @" Public Sub Foo() End Sub "; var model = InitialModel( "TestModule", DeclarationType.ProceduralModule, ("TestModule", code, ComponentType.StandardModule)); var targetName = model.Target.IdentifierName; Assert.AreEqual("TestModule", targetName); }
private void writeInitialDataIntoPage(HtmlDocument document) { var cleanJson = JsonSerialization.ToCleanJson(_persistence.Hierarchy.Top); document.Body.Add("div").Hide().Id("hierarchy-data").Text(cleanJson); var resultJson = JsonSerialization.ToCleanJson(_persistence.AllCachedResults()); document.Body.Add("div").Hide().Id("result-data").Text(resultJson); var model = new InitialModel(_context.LatestSystemRecycled, new HierarchyLoaded(_persistence.Hierarchy.Top, _persistence.Results)); model.wsAddress = _connector.WebSocketsAddress; // TODO -- put the queue state on here too!!!!! var script = new StringWriter(); script.WriteLine(); script.WriteLine("var Storyteller = {};"); script.WriteLine(); script.WriteLine("Storyteller.initialization = {0};", JsonSerialization.ToCleanJson(model)); script.WriteLine(); document.Head.Add("script").Encoded(false).Text(script.ToString()).Attr("type", "text/javascript"); }
private static void writeInitialization(InitialModel initialization) { var json = JsonSerialization.ToIndentedJson(initialization); var path = TestingContext.FindClientFolder().AppendPath("initialization.js"); new FileSystem().WriteStringToFile(path, "module.exports = " + json); }
public void CreateWhatever(InitialModel whatever) { if (whatever == null) { throw new ArgumentNullException(nameof(whatever)); } _context.InitialModels.Add(whatever); }
public void MoveToFolderRefactoring_InitialModel_NameContainingDoubleQuotes() { const string code = @" '@Folder(""MyNew""""Folder.My""""""""""""""""SubFolder"") Public Sub Foo() End Sub "; var model = InitialModel( "TestModule", DeclarationType.ProceduralModule, ("TestModule", code, ComponentType.StandardModule)); var targetName = model.Targets.Single().IdentifierName; var initialTargetFolder = model.TargetFolder; Assert.AreEqual("TestModule", targetName); Assert.AreEqual("MyNew\"Folder.My\"\"\"\"SubFolder", initialTargetFolder); }
public void MoveToFolderRefactoring_InitialModel_UpdateAnnotation() { const string code = @" '@Folder(""MyOldFolder.MyOldSubfolder.SubSub"") Public Sub Foo() End Sub "; var model = InitialModel( "TestModule", DeclarationType.ProceduralModule, ("TestModule", code, ComponentType.StandardModule)); var targetName = model.Targets.Single().IdentifierName; var initialTargetFolder = model.TargetFolder; Assert.AreEqual("TestModule", targetName); Assert.AreEqual("MyOldFolder.MyOldSubfolder.SubSub", initialTargetFolder); }
public void MoveContainingFolderRefactoring_InitialModel_MultipleInFolder() { const string code1 = @" '@Folder(""MyOldFolder.MyOldSubFolder"") Public Sub Foo() End Sub "; const string code2 = @" '@Folder(""MyOldFolder.MyOldSubFolder"") Public Sub Foo() End Sub "; const string code3 = @" '@Folder(""MyOldFolder.MyOldSubFolder.SubSub"") Public Sub Foo() End Sub "; const string code4 = @" '@Folder(""MyOldFolder.MyOtherSubFolder"") Public Sub Foo() End Sub "; var model = InitialModel( "TestModule", DeclarationType.ProceduralModule, ("TestModule", code1, ComponentType.StandardModule), ("SameFolderModule", code2, ComponentType.StandardModule), ("SubFolderModule", code3, ComponentType.StandardModule), ("OtherFolderModule", code4, ComponentType.StandardModule)); var sourceFolder = model.ModulesBySourceFolder.Keys.Single(); var targetModuleNames = model.ModulesBySourceFolder[sourceFolder] .Select(module => module.IdentifierName) .OrderBy(name => name) .ToList(); var initialTargetFolder = model.TargetFolder; Assert.AreEqual("MyOldFolder.MyOldSubFolder", sourceFolder); Assert.AreEqual(3, targetModuleNames.Count); Assert.AreEqual("SameFolderModule", targetModuleNames[0]); Assert.AreEqual("SubFolderModule", targetModuleNames[1]); Assert.AreEqual("TestModule", targetModuleNames[2]); Assert.AreEqual("MyOldFolder", initialTargetFolder); }
public void DeleteWhatever(InitialModel whatever) { if (whatever == null) { throw new ArgumentNullException(nameof(whatever)); } _context.InitialModels.Remove(whatever); _context.SaveChanges(); }
private static void writeInitialization(InitialModel initialization) { var json = JsonSerialization.ToIndentedJson(initialization); var path = AppDomain.CurrentDomain.BaseDirectory .ParentDirectory().ParentDirectory() // project dir .ParentDirectory().ParentDirectory() // root .AppendPath("client", "initialization.js"); new FileSystem().WriteStringToFile(path, "module.exports = " + json); }
public void MoveContainingFolderRefactoring_InitialModel_SubFolder() { const string code = @" '@Folder(""MyOldFolder.MyOldSubFolder.SubSub"") Public Sub Foo() End Sub "; var model = InitialModel( "TestModule", DeclarationType.ProceduralModule, ("TestModule", code, ComponentType.StandardModule)); var sourceFolder = model.ModulesBySourceFolder.Keys.Single(); var targetModuleName = model.ModulesBySourceFolder[sourceFolder].Single().IdentifierName; var initialTargetFolder = model.TargetFolder; Assert.AreEqual("MyOldFolder.MyOldSubFolder.SubSub", sourceFolder); Assert.AreEqual("TestModule", targetModuleName); Assert.AreEqual("MyOldFolder.MyOldSubFolder", initialTargetFolder); }
public IEnumerable <InitialModel> GetStrainInitValue(string type) { var modelList = new List <InitialModel>(); using (OdbcConnection conn = new OdbcConnection(connectionString)) { OdbcCommand cmd = new OdbcCommand(); conn.Open(); cmd.Connection = conn; try { if (type.Equals("strain")) { cmd.CommandText = "SELECT SILO_NO, DIRECTION, CHANNEL, STRAIN_INIT, TEMP, CALIBRATION_FACTOR FROM INIT_STRAIN"; } else if (type.Equals("disp")) { cmd.CommandText = "SELECT SILO_NO, DIRECTION, CHANNEL, ANGLE, TEMP, SCALE_FACTOR FROM INIT_DISPLACEMENT"; } OdbcDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { var model = new InitialModel(); model.SiloNo = (int)reader[0]; model.Direction = (string)reader[1]; model.Channel = (string)reader[2]; model.Value1 = (float)reader[3]; // strain이면 εc값, displacement이면 Δ값 model.Value2 = (float)reader[4]; // 온도보정 model.Value3 = (float)reader[5]; // 보정계수 modelList.Add(model); } reader.Close(); } catch (Exception ex) { logger.Error("Error Get Initial Value", ex); } finally { if (conn != null) { conn.Dispose(); } } } return(modelList); }
public void write_initial_model() { // You need to compile everything before trying to use this var input = new ProjectInput { Path = AppDomain.CurrentDomain.BaseDirectory.ParentDirectory() .ParentDirectory() .ParentDirectory() .AppendPath("Storyteller.Samples"), ProfileFlag = "Safari" }; using (var controller = input.BuildRemoteController()) { controller.Start(EngineMode.Batch).Wait(30.Seconds()); var hierarchy = HierarchyLoader.ReadHierarchy(input.Path.AppendPath("Specs")); var request = new BatchRunRequest { SpecPath = input.SpecPath }; var response = controller.Send(request).AndWaitFor <BatchRunResponse>(); var cache = new ResultsCache(); response.Result.records.Each( x => { var completed = new SpecExecutionCompleted(x.specification.id, x.results, x.specification); cache.Store(completed); }); response.Result.fixtures = controller.LatestSystemRecycled.fixtures; var hierarchyLoaded = new HierarchyLoaded(hierarchy, cache); var initialization = new InitialModel(controller.LatestSystemRecycled, hierarchyLoaded) { wsAddress = "ws://localhost:" + 8200 }; writeResponse(response.Result); //writeInitialization(initialization); } }
public void UpdateWhatever(InitialModel whatever) { // _context.InitialModels.Add(whatever); // this instruction is not necessary it seems }
public void DeleteWhatever(InitialModel initialModel) { throw new NotImplementedException(); }