我是 WSL 的新手,正在运行 Ubuntu。我在 Windows 中安装了 SQL Server 2017 的本地实例,并想从 WSL 连接到它。我启用了远程连接,但是,我似乎无法在本地从 ubuntu 连接。
我为 ubuntu 安装了 db 工具,我正在使用 sqlcmd:
sqlcmd -S localhost -U sa -P <my password>
Run Code Online (Sandbox Code Playgroud)
这一直失败。我如何格式化/配置它以允许 Windows 中的 SQL Server 可用于 Ubuntu?
谢谢!
编辑
我正在使用 SQL Server 的默认实例
这是我得到的错误
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : …Run Code Online (Sandbox Code Playgroud) 我将尝试缩短此代码示例:
public interface IThing
{
//... Stuff
}
public class Thing1 : IThing
{
}
public class Thing2 : IThing
{
}
public interface IThingView<out T>
{
ICollection<T> ViewAll();
}
public class ThingView<T> : IThingView<T>
{
ICollection<T> ViewAll() { return new List<T>(); } // There's a big operation here
}
public interface IThingViewerFactory
{
public IThingView<IThing> Build(string Which);
}
public class ThingViewerFactory
{
public IThingView<IThing> Build(string Which)
{
if(Which.Equals("Thing1") { return new (IThingView<IThing>)new ThingViewer<Thing1>();}
else { return new (IThingView<IThing>)new ThingViewer<Thing2>();} …Run Code Online (Sandbox Code Playgroud) 我在测试我的组件时遇到问题,该组件对 Material-UI 自动完成功能进行了薄薄的包装。在我的测试中,我想查看传递给 的道具,但我的控制台语句是一个空对象。我正在使用 Enzyme 的浅层方法来呈现它。这是我的代码:
const underlineFocusStyle = {
display: 'block',
height: '100%',
outline: 'none',
position: 'relative',
padding: '0px',
width: '100%',
border: 'none',
backgroundColor: 'rgba(0, 0, 0, 0)',
cursor: 'inherit',
opacity: '1'
};
export class MyAutoComplete extends React.Component {
render() {
let { muiTheme, forceOpenOnFocus, ...propsToApply } = this.props;
propsToApply.underlineFocusStyle = underlineFocusStyle;
if (forceOpenOnFocus) {
if (!propsToApply.filter) {
propsToApply.filter = ((searchText, key) => {
return searchText === '' || AutoComplete.defaultProps.filter(searchText, key);
});
}
}
return <AutoComplete name={'autocomplete'} {...propsToApply} />; …Run Code Online (Sandbox Code Playgroud) 如何在 React JS 单元测试中检查渲染元素的宽度?我正在使用酶和 PhantomJS。这基本上是我想要做的:
import React from 'react';
import { mount } from 'enzyme';
import EditableLabel from '../../../src/Common/EditableLabel/EditableLabel.jsx';
describe.only('./Controls/src/Common/EditableLabel/EditableLabel.jsx', () => {
it('should resize the text box to at least the size of the label', () => {
let wrapper = mount(<EditableLabel text={'SomeValue'} editing={true} />);
let spanElements = wrapper.find('span.not-editing');
let inputElements = wrapper.find('input[type="text"].editing');
expect(inputElements.at(0).width()).to.be.at.least(spanElements.at(0).width());
});
Run Code Online (Sandbox Code Playgroud)
});
显然,这会导致错误。我希望我目前的设置可以实现这样的事情。
我有很多代码传递 HTML 5 文件对象。我为它编写了一套测试,但是,由于文件对象的上次修改日期,它破坏了我的快照测试。
我尝试使用以下方式进行模拟:
jest.mock('File', () => {
return class MockFile {
filename: string;
constructor(parts: (string | Blob | ArrayBuffer | ArrayBufferView)[], filename: string, properties?: FilePropertyBag) {
this.filename = filename;
}
}
});
Run Code Online (Sandbox Code Playgroud)
我收到错误消息,提示找不到文件模块(我不需要在使用它的任何地方导入它......)
我还尝试扩展文件类并覆盖 lastmodified get 属性,但它似乎并没有修复我的快照。
处理这个问题的最佳方法是什么?
enzyme ×2
javascript ×2
reactjs ×2
unit-testing ×2
c# ×1
flowtype ×1
generics ×1
jestjs ×1
material-ui ×1
phantomjs ×1
sql-server ×1
testing ×1
ubuntu ×1
variant ×1