Пример #1
0
        internal static void SetwasOutput(this SearchPathHelper targetClass, bool value)
        {
            var po = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject(targetClass);

            try
            {
                po.SetFieldOrProperty("wasOutput", value);
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("wasOutput with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
        internal static void SetExecutionDate(this ExecutedFile targetClass, DateTime value)
        {
            var po = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject(targetClass);

            try
            {
                po.SetFieldOrProperty("ExecutionDate", value);
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("ExecutionDate with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
        internal static void SetMinor(this DatabaseVersion targetClass, string value)
        {
            var po = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject(targetClass);

            try
            {
                po.SetFieldOrProperty("Minor", value);
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("Minor with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #4
0
        public void LoadPrimaryCollectionButtons_CollectionNameHasAmpersand_IsEscaped()
        {
            // Setup //
            var collectionFolder          = new TemporaryFolder("LibraryListViewTests");
            var collectionSettings        = new CollectionSettings();
            var privateCollectionSettings = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject(collectionSettings);

            privateCollectionSettings.SetFieldOrProperty("CollectionName", "A&B");

            _view = new LibraryListView(new FakeLibraryModel(collectionFolder, collectionSettings), new BookSelection(), new SelectedTabChangedEvent(), new LocalizationChangedEvent(), new BookStatusChangeEvent(), null);

            // System Under Test //
            _view.LoadPrimaryCollectionButtons();

            // Verification //
            var obj = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject(_view);
            var primaryCollectionFlow = (FlowLayoutPanel)(obj.GetFieldOrProperty("_primaryCollectionFlow"));
            var listHeader            = primaryCollectionFlow.Controls.OfType <ListHeader>().First();

            Assert.AreEqual("A&&B", listHeader.Label.Text);
        }