Example #1
0
        public void ActivityLog_Dispose()
        {
            var service = new ActivityLogsController(_activityLogRepository);

            service.Dispose();
            Assert.IsTrue(((ActivityLogRepositoryMock)_activityLogRepository).Disposed);
        }
Example #2
0
 public void ActivityLog_ReturnsLogById_Invalid()
 {
     // Arrange
     var service = new ActivityLogsController(_activityLogRepository);
     // Act
     var result = service.GetActivityLogByID("100");
 }
Example #3
0
        public void ActivityLog_ReturnsAllLogs_Invalid()
        {
            // Arrange
            var service = new ActivityLogsController(_activityLogRepository);

            ((ActivityLogRepositoryMock)_activityLogRepository).AddShouldFail = true;

            // Act
            var result = service.GetAllLogs();
        }
Example #4
0
        public void ActivityLog_ReturnsAllLogs()
        {
            // Arrange
            var service = new ActivityLogsController(_activityLogRepository);

            // Act
            var result = service.GetAllLogs();

            // Assert
            Assert.AreEqual(6, result.Count());
        }
Example #5
0
        public void ActivityLog_ReturnsLogById()
        {
            // Arrange
            var service = new ActivityLogsController(_activityLogRepository);

            // Act
            var result = service.GetActivityLogByID("2edbc12f-4fd8-4fed-a848-b8bfff4d4e03") as OkNegotiatedContentResult <APIActivityLogs>;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("12-2234567", result.Content.EIN);
        }
Example #6
0
        public static string addLog(HttpSessionStateBase Session, string log, Guid ReferenceId, object oldValue, object newValue, string format)
        {
            string newlog = string.Empty;

            newlog = Util.appendChange(newlog, oldValue, newValue, format);
            if (string.IsNullOrEmpty(newlog))
            {
                return(log);
            }
            else
            {
                ActivityLogsController.Add(db, Session, ReferenceId, newlog);
                db.SaveChanges();
                return(Util.append(log, string.Format("UPDATE: {0} to {1}", oldValue, newValue), Environment.NewLine + Environment.NewLine));
            }
        }