示例#1
0
        public void Then_Gets_Same_Directory(DirectoryFactory directoryFactory)
        {
            var directory1 = directoryFactory.GetDirectory();
            var directory2 = directoryFactory.GetDirectory();

            directory1.Should().BeSameAs(directory2);
        }
示例#2
0
        public void Then_Adds_Doc_For_Each_Standard(
            List <Standard> standards,
            Mock <ICoursesDataContext> mockDataContext,
            DirectoryFactory directoryFactory)
        {
            mockDataContext
            .Setup(context => context.Standards)
            .ReturnsDbSet(standards);
            var builder = new CoursesIndexBuilder(mockDataContext.Object, directoryFactory);

            builder.Build();

            var directory = directoryFactory.GetDirectory();
            var files     = directory.ListAll();

            files.Length.Should().NotBe(0);
        }
示例#3
0
        public void And_Called_Multiple_Times_Then_No_Duplicates(
            List <Standard> standards,
            Mock <ICoursesDataContext> mockDataContext,
            DirectoryFactory directoryFactory)
        {
            var directory = directoryFactory.GetDirectory();

            mockDataContext
            .Setup(context => context.Standards)
            .ReturnsDbSet(standards);
            var builder = new CoursesIndexBuilder(mockDataContext.Object, directoryFactory);

            // act
            builder.Build();
            var firstFiles = directory.ListAll();

            builder.Build();
            var secondFiles = directory.ListAll();

            firstFiles.Length.Should().NotBe(0);
            secondFiles.Length.Should().Be(firstFiles.Length);
        }