public void RelationshipController_SaveRelationshipType_Calls_EventLogController_AddLog() { //Arrange var mockEventLogController = new Mock<IEventLogController>(); mockEventLogController.Setup(c => c.AddLog(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<EventLogController.EventLogType>())); CreateLocalizationProvider(); var relationshipController = CreateRelationshipController(mockEventLogController); var relationshipType = new RelationshipType() { RelationshipTypeId = Constants.SOCIAL_FollowerRelationshipTypeID, Name = Constants.SOCIAL_RelationshipTypeName }; //Act relationshipController.SaveRelationshipType(relationshipType); //Assert var logContent = string.Format(Constants.LOCALIZATION_RelationshipType_Updated, Constants.SOCIAL_RelationshipTypeName); mockEventLogController.Verify(e => e.AddLog("Message", logContent, EventLogController.EventLogType.ADMIN_ALERT)); }
public void RelationshipController_SaveRelationship_Calls_DataCache_RemoveCache() { //Arrange var relationshipController = CreateRelationshipController(); var cacheKey = CachingProvider.GetCacheKey(DataCache.RelationshipTypesCacheKey); var relationshipType = new RelationshipType() { RelationshipTypeId = Constants.SOCIAL_FollowerRelationshipTypeID }; //Act relationshipController.SaveRelationshipType(relationshipType); //Assert mockCachingProvider.Verify(e => e.Remove(cacheKey)); }
public void RelationshipController_SaveRelationshipType_Calls_DataService() { //Arrange var mockDataService = CreateMockDataServiceWithRelationshipTypes(); var relationshipController = CreateRelationshipController(mockDataService); var relationshipType = new RelationshipType() { RelationshipTypeId = Constants.SOCIAL_FollowerRelationshipTypeID }; //Act relationshipController.SaveRelationshipType(relationshipType); //Assert mockDataService.Verify(d => d.SaveRelationshipType(relationshipType, It.IsAny<int>())); }