Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileDatasource" /> class.
        /// Can be overwritten with
        /// FileName property. 
        /// </summary>
        /// <param name="pathToFilename">full path to filename including postpend slash</param>
        /// <param name="httpContext">HttpContextBase - used to determine config file location</param>
        public FileDatasource(string pathToFilename, HttpContextBase httpContext)
        {
            // set this once in constructor
            this.configurationContext = httpContext;
            this.config = new IssueConfiguration(this.configurationContext);

            this.FileName = pathToFilename + this.config.SerializedIssueListFile;

            if (string.IsNullOrEmpty(this.FileName))
            {
                throw new NullReferenceException("FileDatasource::FileDatasource - FileName is null or empty");
            }
        }
        public void IssueConfigurationConstructorTest()
        {
            // arrange
            HttpContextBase httpContext = null;
            string configFileName = string.Empty;
            string serializedIssueListFile = "IssueFileDatasource";

            // act
            IssueConfiguration target = new IssueConfiguration(httpContext, configFileName);

            // assert
            Assert.IsNotNull(target);
            Assert.AreEqual(serializedIssueListFile, target.SerializedIssueListFile);
            Assert.IsNotNull(target.SmtpSection);
        }
Example #3
0
        public void SetRssIssuesFromUriTest()
        {
            // arrange
            Setup.RunBeforeTests_FeedListFile();

            HttpContextBase context = null;
            string pathToFiles = Setup.GetDataPath();
            IssueMgr issueMgr = new IssueMgr(context);
            IssueConfiguration issueConfig = new IssueConfiguration(context);

            if (File.Exists(pathToFiles + issueConfig.SerializedIssueListFile))
            {
                File.Delete(pathToFiles + issueConfig.SerializedIssueListFile);
            }

            // act
            issueMgr.SetRssIssuesFromUri(pathToFiles);

            // assert
            Assert.IsTrue(File.Exists(pathToFiles + issueConfig.SerializedIssueListFile));

            // cleanup
            File.Delete(pathToFiles + issueConfig.SerializedIssueListFile);
        }