public void Import_ContentUpToDate() { // Arrange WriteMinimalContentFile(); var lastDataStoreVersion = EnumExtensions.GetMaxValue <DataStoreSchemaVersions>(); var dataStoreConfiguration = Mocks.Create <IDataStoreConfiguration>(MockBehavior.Strict); dataStoreConfiguration.SetupGet(c => c.DataStoreSchemaVersion).Returns((int)lastDataStoreVersion); dataStoreConfiguration.SetupGet(c => c.HelpContentVersion).Returns(1); var helpContentManager = new HelpContentManager(null, dataStoreConfiguration.Object, null, null, null); // Act helpContentManager.ImportContent(_contentFileName); // Assert Mocks.VerifyAll(); }
public void Import_UpdateContent() { // Arrange WriteMinimalContentFile(); var bulletRepository = Mocks.Create <IBulletRepository>(); bulletRepository.Setup(r => r.DeleteExcept(It.IsAny <List <int> >())); var lastDataStoreVersion = EnumExtensions.GetMaxValue <DataStoreSchemaVersions>(); var dataStoreConfiguration = Mocks.Create <IDataStoreConfiguration>(MockBehavior.Strict); dataStoreConfiguration.SetupGet(c => c.DataStoreSchemaVersion).Returns((int)lastDataStoreVersion); dataStoreConfiguration.SetupGet(c => c.HelpContentVersion).Returns(0); dataStoreConfiguration.SetupSet(c => c.HelpContentVersion = 1); var pageRepository = Mocks.Create <IDocumentationPageRepository>(); pageRepository.Setup(r => r.DeleteExcept(It.IsAny <List <int> >())); var helpRepository = Mocks.Create <IFirstTimeHelpRepository>(); helpRepository.Setup(r => r.DeleteExcept(It.IsAny <List <int> >())); var userPageSettingsRepository = Mocks.Create <IUserPageSettingsRepository>(); userPageSettingsRepository.Setup(r => r.DeleteExcept(It.IsAny <List <int> >())); var updater = new HelpContentManager( bulletRepository.Object, dataStoreConfiguration.Object, pageRepository.Object, helpRepository.Object, userPageSettingsRepository.Object); // Act updater.ImportContent(_contentFileName); // Assert Mocks.VerifyAll(); }
public void Import_FileNotPresent() { // Arrange // No methods should be called on the repositories. // Default behavior strict and the verify all assure this. var bulletRepository = Mocks.Create <IBulletRepository>(); var dataStoreConfiguration = Mocks.Create <IDataStoreConfiguration>(); var pageRepository = Mocks.Create <IDocumentationPageRepository>(); var helpRepository = Mocks.Create <IFirstTimeHelpRepository>(); var userPageSettingsRepository = Mocks.Create <IUserPageSettingsRepository>(); var updater = new HelpContentManager( bulletRepository.Object, dataStoreConfiguration.Object, pageRepository.Object, helpRepository.Object, userPageSettingsRepository.Object); // Act updater.ImportContent(_contentFileName); // Assert Mocks.VerifyAll(); }