コード例 #1
0
ファイル: WidgetDefinition.cs プロジェクト: ArildF/Smeedee
        public static WidgetDefinition FromWidgetInfo(WidgetInfo widgetInfo)
        {
            if (widgetInfo == null || string.IsNullOrEmpty(widgetInfo.Type) || string.IsNullOrEmpty(widgetInfo.XAPName))
                throw new InvalidOperationException("The widgetInfo needs to contain the type and the XAP name of the widget");

            return new WidgetDefinition()
                       {
                           Type = widgetInfo.Type,
                           XAPName = widgetInfo.XAPName
                       };
        }
コード例 #2
0
        public void Assure_information_is_set_correctly()
        {
            widgetName = "My Widget";
            widgetType = "MyNamespace.Widgets.MyWidget";
            widgetXapName = "MyWidgets_2010.xap";
            var widgetInfo = new WidgetInfo()
                                 {
                                     Name = widgetName,
                                     Type = widgetType,
                                     XAPName = widgetXapName
                                 };

            var widgetDefiniton = WidgetDefinition.FromWidgetInfo(widgetInfo);
            
            widgetDefiniton.XAPName.ShouldBe(widgetXapName);
            widgetDefiniton.Type.ShouldBe(widgetType);
        }