Example #1
0
        public void LogsExpiration()
        {
            logger.AddError(new ErrorEntity()
            {
                Property1 = "Property 1",
                Property2 = "Sample 1"
            }, "Error message", "Long message");

            var repoItems = repo.GetAll();

            Assert.IsTrue(repoItems.Count() == 1);

            // We change expiration date to -1 in order to make all new logs automatically expired :
            logger = new NoSqlLogger(repo, -1);

            logger.AddError(new ErrorEntity()
            {
                Property1 = "Property 2",
                Property2 = "Sample 2"
            }, "Expired log", "Long message");

            repoItems = repo.GetAll();

            Assert.IsTrue(repoItems.Count() == 1);
        }
Example #2
0
        public void TestInitialize()
        {
            var dbName = "logsDb";

            repo = new JsonFileRepository <Log>(NoSQLCoreUnitTests.testContext.DeploymentDirectory, dbName);
            repo.TruncateCollection();
            logger = new NoSqlLogger(repo);
        }