Esempio n. 1
0
        public async Task IsValidReleaseEntry_FilesizeCheck()
        {
            Assert.ThrowsAsync <Exception>(async() =>
                                           await DummyReleaseEntry.MakeDummyReleaseEntry(false, string.Empty,
                                                                                         invalidReleaseOptions: InvalidReleaseEntry.Filesize));

            await RunIsValidReleaseEntryTest(InvalidReleaseEntry.Filesize, true, true);
        }
Esempio n. 2
0
        private async Task RunIsValidReleaseEntryTest(InvalidReleaseEntry invalidReleaseEntry, bool createFile, bool onlyCheckFail = false)
        {
            var releaseFile = await DummyReleaseEntry.MakeDummyReleaseEntry(createFile, ".tuup");

            Assert.IsTrue(releaseFile.IsValidReleaseEntry(SemanticVersion.BaseVersion(), createFile),
                          "ReleaseEntry checking failed when we should of passed");

            if (!onlyCheckFail)
            {
                releaseFile = await DummyReleaseEntry.MakeDummyReleaseEntry(createFile, ".tuup", invalidReleaseOptions : invalidReleaseEntry);

                Assert.IsFalse(releaseFile.IsValidReleaseEntry(SemanticVersion.BaseVersion(), createFile),
                               "ReleaseEntry checking passed when we should of failed");
            }
        }
Esempio n. 3
0
        public async Task IsValidReleaseEntry_FileCheck()
        {
            //Check that we fail the file when the file doesn't exist
            var releaseFile = await DummyReleaseEntry.MakeDummyReleaseEntry(false, ".tuup");

            Assert.IsFalse(releaseFile.IsValidReleaseEntry(new SemanticVersion(1, 0, 0), true), "File checking failed, Returning true when we should have false");

            //Check that we check the file correctly when everything is passed as it should be
            releaseFile = await DummyReleaseEntry.MakeDummyReleaseEntry(true, ".tuup");

            Assert.IsTrue(releaseFile.IsValidReleaseEntry(new SemanticVersion(1, 0, 0), true), "File checking failed, Returning false when we should have true");

            //Now we make one with a invalid filename name (no filename + invalid name), we should throw when this is the case
            Assert.ThrowsAsync <InvalidFileNameException>(async() => await DummyReleaseEntry.MakeDummyReleaseEntry(false, string.Empty, string.Empty), "We didn't throw on a filename that is nothing!");
            Assert.ThrowsAsync <InvalidFileNameException>(async() => await DummyReleaseEntry.MakeDummyReleaseEntry(false, CreateInvalidFilename()), "We didn't throw on a filename that is invalid!");
        }