コード例 #1
0
        public void GetStreamReader_ExistingFile_ReturnsStream()
        {
            var fileInfo   = new FileInfo("test.haml");
            var textReader = new FileViewSource(fileInfo).GetTextReader();

            Assert.That(textReader.Peek() != 0);
        }
コード例 #2
0
 public NewConvertController(ILogger <NewConvertController> logger, UserViewSource userSource, BanViewSource banSource,
                             ModuleViewSource moduleViewSource, FileViewSource fileViewSource, ContentViewSource contentViewSource,
                             CategoryViewSource categoryViewSource, VoteViewSource voteViewSource, WatchViewSource watchViewSource,
                             CommentViewSource commentViewSource, ActivityViewSource activityViewSource,
                             ContentApiDbConnection cdbconnection, IEntityProvider entityProvider,
                             ModuleMessageViewSource moduleMessageViewSource,
                             ModuleRoomMessageViewSource moduleRoomMessageViewSource,
                             NewConvertControllerConfig config,
                             IHistoryService historyService,
                             IHistoryConverter historyConverter,
                             /*ContentApiDbContext ctapiContext,*/ IMapper mapper)
 {
     this.logger         = logger;
     this.userSource     = userSource;
     this.banSource      = banSource;
     this.moduleSource   = moduleViewSource;
     this.fileSource     = fileViewSource;
     this.contentSource  = contentViewSource;
     this.categorySource = categoryViewSource;
     this.voteSource     = voteViewSource;
     this.watchSource    = watchViewSource;
     this.commentSource  = commentViewSource;
     this.activitySource = activityViewSource;
     //this.ctapiContext = ctapiContext;
     this.mapper               = mapper;
     this.newdb                = cdbconnection.Connection;
     this.entityProvider       = entityProvider;
     this.moduleMessageSource  = moduleMessageViewSource;
     this.moduleRMessageSource = moduleRoomMessageViewSource;
     this.config               = config;
     this.historyService       = historyService;
     this.historyConverter     = historyConverter;
 }
コード例 #3
0
        public void Setup()
        {
            _tempPath      = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            _configuration = new ViewConfiguration();
            var pathProvider = Substitute.For <IPathProvider>();

            pathProvider.MapPath(Arg.Any <string>()).ReturnsForAnyArgs(_tempPath);
            _viewSource = new FileViewSource(_configuration, pathProvider);
        }
コード例 #4
0
        public void Path_ExistingFile_ReturnsFullPath()
        {
            const string fileName = "test.haml";
            var          fileInfo = new FileInfo(fileName);
            string       path     = new FileViewSource(fileInfo).FilePath;

            Assert.That(path.Length, Is.GreaterThan(fileName.Length));
            Assert.That(path, Is.StringContaining(fileName));
        }
コード例 #5
0
        public void Can_Open_Existing_File()
        {
            var fileInfo   = new FileInfo(Assembly.GetExecutingAssembly().Location);
            var viewSource = new FileViewSource(fileInfo);

            Assert.AreEqual(fileInfo.LastWriteTimeUtc.Ticks, viewSource.LastModified);

            using (Stream viewSourceStream = viewSource.OpenViewStream())
            {
                Assert.IsNotNull(viewSourceStream);
            }
        }
コード例 #6
0
        public void GetClassNameFromPathName_ValidPath_ReturnsValidClass()
        {
            // Arrange
            const string expectedClassName = "test_haml";

            const string fileName   = "test.haml";
            var          viewSource = new FileViewSource(new FileInfo(fileName));

            // Act
            string actual = viewSource.GetClassName();

            // Assert
            Assert.That(actual, Is.StringEnding(expectedClassName));
        }
コード例 #7
0
        public override void ViewDidLoad()
        {
            var source = new FileViewSource(DbPath);

            this.TableView.Source = source;
        }