コード例 #1
0
        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);
        }
コード例 #2
0
        public void Constructor_WhenFileNameContainsAPath_ThenOnlyFileNameIsStored()
        {
            //ARRANGE
            var resourceTest = new ResourceTest("SomeFolder/FileName.data");

            //ACT

            //ASSERT
            Assert.Equal("FileName", resourceTest.Name);
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        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());
        }
コード例 #5
0
        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());
        }
コード例 #6
0
 /// <summary>
 /// 创建资源数据传输对象2
 /// </summary>
 /// <param name="id">资源编号</param>
 public static ResourceDto Create2(Guid id)
 {
     return(ResourceTest.Create2(id).ToDto());
 }
コード例 #7
0
 /// <summary>
 /// 创建资源数据传输对象
 /// </summary>
 public static ResourceDto Create()
 {
     return(ResourceTest.Create().ToDto());
 }