所以我安装了这些nuget软件包:

在这些参考文献中达到高潮:

我用NCrunch。我有这样的规范:
namespace GlobPatternMatching.Tests
{
using FluentAssertions;
using Machine.Fakes;
using Machine.Specifications;
[Subject(typeof(GlobMatching))]
public class When_Given_Literal : WithSubject<GlobMatching>
{
private static string pattern = "path";
private static string[] result;
private Establish context => () =>
{
pattern = "path";
};
private Because of => () => result = Subject.GetGlobs(pattern);
private It should_return_path_in_the_array = () =>
{
result[0].Should().Be("path");
};
}
}对于这门课:
namespace GlobPatternMatching
{
using System;
public class GlobMatching
{
public string[] GetGlobs(string pattern)
{
return pattern.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
}
}
}直截了当地说,我得到的是空引用异常。当我调试时,我无法通过这个方法,而且所有的spec类字段都是空的.
我不觉得我错过了什么,但如果你不介意看看我在这里做错了什么,那就太好了。我用的是最新的VS2015,NCrunch等.
发布于 2016-10-05 13:05:14
你不会相信问题是什么..。
private Establish context => () =>
{
pattern = "path";
};
private Because of => () => result = Subject.GetGlobs(pattern);我让=>代替了=..。
// ----------------------\/-------
private Establish context = () =>
{
pattern = "path";
};
// ----------------\/------------
private Because of = () => result = Subject.GetGlobs(pattern);https://stackoverflow.com/questions/39873712
复制相似问题