/// <summary> /// Initializes a new instance of the <see cref="SampleCommandTests" /> class. /// </summary> public SampleCommandTests() { _mockedSheetRetriever = new Mock <IElementRetriever>(); _mockedDataTableCreator = new Mock <IDataTableCreator>(); _mockedFilePathSelector = new Mock <IFilePathSelector>(); _mockedDataWriter = new Mock <IDataWriter>(); _mockedSampleProperties = new Mock <IRvtCommandProperties <SampleCommand> >(); _mockedSampleProperties.SetupGet(p => p.Name).Returns("Sample"); _mockedSampleProperties.SetupGet(p => p.DisplayName).Returns("Sample Command"); _mockedDialogService = new Mock <IDialogService>(); _mockedDialogService.Setup(dialogService => dialogService.ShowDialog(It.IsAny <string>(), It.IsAny <string>())).Verifiable(); _emptySampleCommand = GetTestSampleCommand(); _externalCommandData = JustMock.Create <ExternalCommandData>(); _uiApplication = JustMock.Create <UIApplication>(); _uiDocument = JustMock.Create <UIDocument>(); _document = JustMock.Create <Document>(); }
public void GetViews_All_Retrieved_Views_Are_Returned() { var viewList = new List <RvtView> { JustMock.Create <RvtView>(), JustMock.Create <RvtView>(), JustMock.Create <RvtView>() }; _mockElementCollector.Setup(coll => coll.GetViews(It.IsAny <Document>())).Returns(viewList); _mockClassMapper.Setup(map => map.Map <View>(It.IsAny <RvtView>())).Returns(Mock.Of <View>()); var elementRetriever = new ElementRetriever(_mockElementCollector.Object, _mockClassMapper.Object); ICollection <View> views = elementRetriever.GetViews(JustMock.Create <Document>()); Assert.NotNull(views); Assert.Equal(viewList.Count, views.Count); }
public void GetSheets_All_Retrieved_Sheets_Are_Returned() { var sheetList = new List <ViewSheet> { JustMock.Create <ViewSheet>(), JustMock.Create <ViewSheet>(), JustMock.Create <ViewSheet>() }; _mockElementCollector.Setup(coll => coll.GetSheets(It.IsAny <Document>())).Returns(sheetList); _mockClassMapper.Setup(map => map.Map <Sheet>(It.IsAny <ViewSheet>())).Returns(Mock.Of <Sheet>()); var elementRetriever = new ElementRetriever(_mockElementCollector.Object, _mockClassMapper.Object); ICollection <Sheet> sheets = elementRetriever.GetSheets(JustMock.Create <Document>()); Assert.NotNull(sheets); Assert.Equal(sheetList.Count, sheets.Count); }