Beispiel #1
0
        public async Task <Project> Identify_base_project(string name, Project expectedProject)
        {
            if (expectedProject == null)
            {
                throw new ArgumentNullException(nameof(expectedProject));
            }

            var expectedProjectContents = GetFileSystemDictionary(expectedProject);

            string expectedPath = $"./{name}";

            FileSystemMock.Setup(m => m.GetRelativePath(expectedProjectContents.Path))
            .Returns(expectedPath);

            var identifier = CreateTestClass();

            bool shouldIdentify = await identifier.ShouldIdentify(null, expectedProjectContents);

            ShouldHaveIdentified(expectedProject, shouldIdentify);

            bool isMatch = await identifier.IsMatchAsync(null, expectedProjectContents);

            ShouldHaveMatched(expectedProject, isMatch);

            var actualProject = await identifier.CreateOrModifyAsync(null, expectedProjectContents); // no project created yet

            FileSystemMock.VerifyAll();

            Assert.Equal(name, actualProject.Name); // used for labeling test
            Assert.Equal(expectedProjectContents.Name, actualProject.Name);
            Assert.Equal(expectedPath, actualProject.Paths.Single());

            return(actualProject);
        }