Esempio n. 1
0
        public void Should_return_unknown_version_when_there_is_an_error()
        {
            TestHeaderWriterStub.Setup(thw => thw.DetectGeneratedTestVersion("any")).Throws(new Exception());

            var testGenerator = CreateTestGenerator();
            FeatureFileInput featureFileInput = CreateSimpleValidFeatureFileInput();

            featureFileInput.GeneratedTestFileContent = "any";
            var result = testGenerator.DetectGeneratedTestVersion(featureFileInput);

            result.Should().Be(null);
        }
Esempio n. 2
0
        public void Should_return_detected_version()
        {
            Version version = new Version();

            TestHeaderWriterStub.Setup(thw => thw.DetectGeneratedTestVersion("any")).Returns(version);

            var testGenerator = CreateTestGenerator();
            FeatureFileInput featureFileInput = CreateSimpleValidFeatureFileInput();

            featureFileInput.GeneratedTestFileContent = "any";
            var result = testGenerator.DetectGeneratedTestVersion(featureFileInput);

            result.Should().NotBeNull();
            result.Should().Be(version);
        }
Esempio n. 3
0
        public void Should_return_detected_version_from_file()
        {
            Version version = new Version();

            TestHeaderWriterStub.Setup(thw => thw.DetectGeneratedTestVersion("any")).Returns(version);

            using (var tempFile = new TempFile(".cs"))
            {
                tempFile.SetContent("any");

                ProjectSettings projectSettings = new ProjectSettings {
                    ProjectFolder = tempFile.FolderName, ProjectPlatformSettings = net35CSSettings
                };
                var testGenerator = CreateTestGenerator(projectSettings);
                FeatureFileInput featureFileInput = CreateSimpleValidFeatureFileInput();
                featureFileInput.GeneratedTestProjectRelativePath = tempFile.FileName;
                var result = testGenerator.DetectGeneratedTestVersion(featureFileInput);

                result.Should().NotBeNull();
                result.Should().Be(version);
            }
        }