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()); }
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()); }
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); }