public void RemoveCodeTest(string input) { var end = @"app.StopAsync(); }".Replace(" ", string.Empty); var root = CSharpSyntaxTree.ParseText(input); var updater = new SourceCodeUpdater(root, Template, _logger); var result = updater.RemoveOldCode(updater.AddTemplateCode(root.GetRoot())).ToFullString().Replace(" ", string.Empty); Assert.Contains(end, result); Assert.DoesNotContain("int UA_placeHolder;", result); }
public void ConfigureServiceHostTest() { var root = CSharpSyntaxTree.ParseText(Input); var updater = new SourceCodeUpdater(root, Template, _logger); var result = updater.AddTemplateCode(root.GetRoot()).ToFullString().Replace(" ", string.Empty); string config = @"serviceBuilder.ConfigureServiceHostBase<SampleService>(host => { host.AddDefaultEndpoints(); });".Replace(" ", string.Empty); Assert.Contains(config, result); }