public void JsonProvider_ReadsFileOk()
        {
            b.Info.Flow();
            var fn = uth.NewTemporaryFileName();

            try {
                Feature f          = new Feature(FEATURENAME, true);
                string  serialised = FeatureSerializer.GetFeatureAsString(f);
                File.WriteAllText(fn, serialised);
            } finally {
                uth.ClearUpTestFiles();
            }
        }
示例#2
0
        public void Blows_IfResourceName_Invalid()
        {
            b.Info.Flow();

            var sut = new UnitTestHelper();

            try {
                Assert.Throws <InvalidOperationException>(() => {
                    _ = sut.GetTestDataFile("monkey-butt");
                });
            } finally {
                sut.ClearUpTestFiles();
            }
        }
示例#3
0
        public void TestDataFile_CleanUpWorks()
        {
            b.Info.Flow();

            var sut   = new UnitTestHelper();
            var ident = TestResources.GetIdentifiers(TestResourcesReferences.SingleTextFile);

            string fname = sut.GetTestDataFile(ident);
            bool   fileExistsBeforeCleanup = File.Exists(fname);

            sut.ClearUpTestFiles();

            Assert.True(fileExistsBeforeCleanup);
            Assert.False(File.Exists(fname));
        }
示例#4
0
        public void File_GetTestData_Works()
        {
            b.Info.Flow();

            var sut = new UnitTestHelper();

            try {
                var ident = TestResources.GetIdentifiers(TestResourcesReferences.SingleTextFile);

                string fname = sut.GetTestDataFile(ident);

                Assert.NotNull(fname);
                Assert.True(File.Exists(fname));
            } finally {
                sut.ClearUpTestFiles();
            }
        }
示例#5
0
        public void File_GetTestData_HasRightContent()
        {
            const string TEXT_FROM_FILE = "arfle barfle gloop";

            b.Info.Flow();

            var sut = new UnitTestHelper();

            try {
                var ident = TestResources.GetIdentifiers(TestResourcesReferences.SingleTextFile);

                string fname = sut.GetTestDataFile(ident);

                string str = File.ReadAllText(fname);

                Assert.Equal(TEXT_FROM_FILE, str);
            } finally {
                sut.ClearUpTestFiles();
            }
        }