Exemplo n.º 1
0
        public void GetHistoryRecords()
        {
            // Arrange
            var mockRepository         = _CreateMockRepository();
            var mockUnitOfWork         = _CreateMockUnitOfWork();
            HistoryRecordService model = new HistoryRecordService(mockRepository, mockUnitOfWork);

            // Act
            var result = model.GetHistoryRecords();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count());
        }
Exemplo n.º 2
0
        public void CreateHistoryRecord()
        {
            // Arrange
            var mockRepository          = _CreateMockRepository();
            var mockUnitOfWork          = _CreateMockUnitOfWork();
            HistoryRecordService model  = new HistoryRecordService(mockRepository, mockUnitOfWork);
            int           expectedCount = 3;
            HistoryRecord historyRecord = new HistoryRecord
            {
                CreateDate = DateTime.Now,
                UrlShort   = $"hhhhhh/rrrrr",
                UrlLong    = "http://stackoverflow.com"
            };

            // Act
            model.CreateHistoryRecord(historyRecord);

            // Assert
            Assert.AreEqual(expectedCount, model.GetHistoryRecords().Count());
        }
Exemplo n.º 3
0
        public void UpdateHistoryRecord()
        {
            // Arrange
            var mockRepository         = _CreateMockRepository();
            var mockUnitOfWork         = _CreateMockUnitOfWork();
            HistoryRecordService model = new HistoryRecordService(mockRepository, mockUnitOfWork);
            long   id       = 2;
            string urlShort = "changed";

            HistoryRecord historyRecord = new HistoryRecord
            {
                Id         = id,
                CreateDate = DateTime.Now,
                UrlShort   = urlShort,
                UrlLong    = "http://stackoverflow.com"
            };

            // Act
            model.UpdateHistoryRecord(historyRecord);

            // Assert
            Assert.AreEqual(urlShort, model.GetHistoryRecord(id).UrlShort);
        }