public void LogResultListener() { LogResultListener log = new LogResultListener { FilePath = new MacroString { Text = "logResult.txt" } }; var expanded = log.FilePath.Expand(); // If debugging the LogResultListener will just rename the file since it might exist if (System.IO.File.Exists(expanded)) { System.IO.File.Delete(expanded); } ResourceTest.TestConformance(log); var testPlan = TestStepTest.CreateGenericTestPlan(); testPlan.Steps.Add(new TestStepEmit()); ResultSettings.Current.Add(log); var run = testPlan.Execute(); var logText = System.IO.File.ReadAllText(expanded, System.Text.Encoding.ASCII); StringAssert.Contains("This was called", logText); ResultSettings.Current.Remove(log); }
public void Constructor_WhenFileNameContainsAPath_ThenOnlyFileNameIsStored() { //ARRANGE var resourceTest = new ResourceTest("SomeFolder/FileName.data"); //ACT //ASSERT Assert.Equal("FileName", resourceTest.Name); }
public void Data_WhenTestFileContainsOneEntry_ThenReturnsAListWithOneItem() { //ARRANGE var resourceTest = new ResourceTest(Path.Combine(DataFiles, "OneResource.data")); //ACT var data = resourceTest.Data; //ASSERT Assert.Equal(1, data.Count()); }
public void Data_WhenTestFileContainsNoEntries_ThenReturnsAListWithNoItems() { //ARRANGE var resourceTest = new ResourceTest(Path.Combine(DataFiles, "EmptyResources.data")); //ACT var data = resourceTest.Data; //ASSERT Assert.Equal(0, data.Count()); }
public void Data_WhenTestFileContainsManyEntries_ThenReturnsCorrectNumberOfEntries() { //ARRANGE var resourceTest = new ResourceTest(Path.Combine(DataFiles, "ManyResources.data")); //ACT var data = resourceTest.Data; //ASSERT Assert.Equal(14, data.Count()); }
/// <summary> /// 创建资源数据传输对象2 /// </summary> /// <param name="id">资源编号</param> public static ResourceDto Create2(Guid id) { return(ResourceTest.Create2(id).ToDto()); }
/// <summary> /// 创建资源数据传输对象 /// </summary> public static ResourceDto Create() { return(ResourceTest.Create().ToDto()); }