コード例 #1
0
        public void Blows_IfResourceName_Invalid()
        {
            b.Info.Flow();

            var sut = new UnitTestHelper();

            try {
                Assert.Throws <InvalidOperationException>(() => {
                    _ = sut.GetTestDataFile("monkey-butt");
                });
            } finally {
                sut.ClearUpTestFiles();
            }
        }
コード例 #2
0
        public void GetTestDatFile_BlowsOnNull()
        {
            b.Info.Flow();

            Assert.Throws <ArgumentOutOfRangeException>(() => {
                var sut = new UnitTestHelper();
                sut.GetTestDataFile(null);
            });

            Assert.Throws <ArgumentOutOfRangeException>(() => {
                var sut = new UnitTestHelper();
                sut.GetTestDataFile("");
            });
        }
コード例 #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();
            }
        }