示例#1
0
        public void GetLibraryBasePath_should_get_correct_paths_for_assembly_based_path()
        {
            var subject = new TestRelativeLibraryLocator(mockedAssemblyUri: null);

            var result = subject.GetLibraryBasePath();

            // Ideally the root folder for expectedResult should be mongo-csharp-driver,
            // but since it's not mocked logic it limits us where we can run our tests from. Avoid it by
            // making a test assertation less straight
            var expectedResult = GetCommonTestAssemblyFolderEnding();

            result.Should().EndWith(expectedResult);
        }
示例#2
0
        public void GetLibraryBasePath_should_get_correct_paths_with_mocking(string rootTestFolder, string expectedRootTestFolder)
        {
            var assemblyCodeBase = Path.Combine(
                RequirePlatform.GetCurrentOperatingSystem() == SupportedOperatingSystem.Windows ? "C:/" : @"\\data",
                rootTestFolder,
                GetCommonTestAssemblyFolderEnding(),
                "MongoDB.Driver.Core.dll");
            var testAssemblyCodeBaseUri = new Uri(assemblyCodeBase).ToString();
            var subject = new TestRelativeLibraryLocator(mockedAssemblyUri: testAssemblyCodeBaseUri);

            var result = subject.GetLibraryBasePath();

            var expectedResult = Path.Combine(expectedRootTestFolder, GetCommonTestAssemblyFolderEnding());

            result.Should().EndWith(expectedResult);
        }