コード例 #1
0
        public void EditValue_WithCurrentItemInAvailableItems_ReturnsCurrentItem()
        {
            // Setup
            var selectedHydraulicBoundaryLocation = new HydraulicBoundaryLocation(23, "name", 0, 0);
            var properties = new ObjectPropertiesWithSelectableHydraulicBoundaryLocation(
                new SelectableHydraulicBoundaryLocation(selectedHydraulicBoundaryLocation, null),
                new[]
            {
                new SelectableHydraulicBoundaryLocation(selectedHydraulicBoundaryLocation, null)
            });
            var propertyBag       = new DynamicPropertyBag(properties);
            var editor            = new HydraulicBoundaryLocationEditor();
            var someValue         = new object();
            var serviceProvider   = mockRepository.Stub <IServiceProvider>();
            var service           = mockRepository.Stub <IWindowsFormsEditorService>();
            var descriptorContext = mockRepository.Stub <ITypeDescriptorContext>();

            serviceProvider.Stub(p => p.GetService(null)).IgnoreArguments().Return(service);
            descriptorContext.Stub(c => c.Instance).Return(propertyBag);
            mockRepository.ReplayAll();

            // Call
            object result = editor.EditValue(descriptorContext, serviceProvider, someValue);

            // Assert
            Assert.AreEqual(new SelectableHydraulicBoundaryLocation(selectedHydraulicBoundaryLocation, null), result);

            mockRepository.VerifyAll();
        }
コード例 #2
0
        public void DefaultConstructor_ReturnsNewInstance()
        {
            // Call
            var editor = new HydraulicBoundaryLocationEditor();

            // Assert
            Assert.IsInstanceOf <SelectionEditor <IHasHydraulicBoundaryLocationProperty, SelectableHydraulicBoundaryLocation> >(editor);
        }