public void GetStreamReader_ExistingFile_ReturnsStream() { var fileInfo = new FileInfo("test.haml"); var textReader = new FileViewSource(fileInfo).GetTextReader(); Assert.That(textReader.Peek() != 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; }
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); }
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)); }
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); } }
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)); }
public override void ViewDidLoad() { var source = new FileViewSource(DbPath); this.TableView.Source = source; }