//****************************************

        private Bin WalkWidgets(Container parent, Type targetType)
        {               //****************************************
            Bin ChildControl;

            //****************************************

            foreach (Widget MyWidget in parent.Children)
            {
                if (MyWidget.GetType() == targetType)
                {
                    return((Bin)MyWidget);
                }

                if (!(MyWidget is Container) || ((Container)MyWidget).Children.Length == 0)
                {
                    continue;
                }

                ChildControl = WalkWidgets((Container)MyWidget, targetType);

                if (ChildControl != null)
                {
                    return(ChildControl);
                }
            }

            return(null);
        }
        public void GetWidgetWithCompanyDiscount_Moq(string companyName, decimal matchingDiscount)
        {
            //arrange
            var service = new Mock <IMyServiceClass>();
            var widget  = new MyWidget
            {
                Price       = 100,
                GuidId      = Guid.NewGuid(),
                Description = "Description",
                Name        = "Name"
            };

            service.Setup(s => s.GetWidget(
                              It.IsAny <string>(),
                              It.IsAny <string>(),
                              It.IsAny <string>()
                              )).Returns(widget);
            service.Setup(s => s.GetWidget(It.IsAny <Guid>())).Returns(widget);
            var expectedPrice = widget.Price - (widget.Price * matchingDiscount);

            var sut = new MyLogicClass(service.Object);

            //act
            var result = sut.GetWidgetWithCompanyDiscount(companyName);

            //assert
            result.Price.Should().Be(expectedPrice);
        }
        public void GetWidgetWithCompanyDiscount_NSub(string companyName, decimal matchingDiscount)
        {
            //arrange
            var service = Substitute.For <IMyServiceClass>();
            var widget  = new MyWidget
            {
                Price       = 100,
                GuidId      = Guid.NewGuid(),
                Description = "Description",
                Name        = "Name"
            };

            var expectedPrice = widget.Price - (widget.Price * matchingDiscount);

            service.GetWidget(guidId: Arg.Any <Guid>())
            .Returns(widget);
            service.GetWidget(
                name: Arg.Any <string>(),
                description: Arg.Any <string>(),
                reference: Arg.Any <string>())
            .Returns(widget);

            var sut = new MyLogicClass(service);

            //act
            var result = sut.GetWidgetWithCompanyDiscount(companyName);

            //assert
            result.Price.Should().Be(expectedPrice);
        }
Exemplo n.º 4
0
Arquivo: t4.cs Projeto: KDE/qyoto
    public static int Main(String[] args)
    {
        new QApplication(args);

        MyWidget w = new MyWidget();
        w.Show();
        return QApplication.Exec();
    }
Exemplo n.º 5
0
Arquivo: main.cs Projeto: KDE/qyoto
 public static int Main(string[] args)
 {
     new QApplication(args);
     MyWidget widget = new MyWidget(null);
     widget.SetGeometry(100, 100, 500, 355);
     widget.Show();
     return QApplication.Exec();
 }
Exemplo n.º 6
0
    public static void Main(string[] args)
    {
        new QApplication(args);
        MyWidget main = new MyWidget((QWidget)null);

        main.Show();
        QApplication.Exec();
    }
Exemplo n.º 7
0
    public static void Main(string[] args)
    {
        new QApplication(args);
        MyWidget main = new MyWidget((QWidget)null);

        main.SetGeometry(100,100,500,355);
        main.Show();
        QApplication.Exec();
    }
Exemplo n.º 8
0
    public static int Main(String[] args)
    {
        new QApplication(args);

        MyWidget w = new MyWidget();

        w.Show();
        return(QApplication.Exec());
    }
Exemplo n.º 9
0
    public static int Main(string[] args)
    {
        new QApplication(args);
        MyWidget widget = new MyWidget(null);

        widget.SetGeometry(100,100,500,355);
        widget.Show();
        return(QApplication.Exec());
    }
Exemplo n.º 10
0
 public void Splork(MyWidget widget)
 {
     if (widget.Validate())
     {
         widgetRepository.Save(widget);
         widget.LastSaved = DateTime.Now;
         OnSaved(new WidgetSavedEventArgs(widget));
     }
     else
     {
         Log.Error("Could not save MyWidget due to a validation error.");
         SendEmailAlert(new WidgetValidationAlert(widget));
     }
 }
Exemplo n.º 11
0
Arquivo: t10.cs Projeto: KDE/qyoto
 public static void Main(string[] args)
 {
     new QApplication(args);
     MyWidget main = new MyWidget((QWidget)null);
     main.SetGeometry(100, 100, 500, 355);
     main.Show();
     QApplication.Exec();
 }
Exemplo n.º 12
0
 public static void Main(string[] args)
 {
     new QApplication(args);
     MyWidget main = new MyWidget((QWidget)null);
     main.Show();
     QApplication.Exec();
 }
Exemplo n.º 13
0
 public MainViewModel()
 {
     Widget = new MyWidget();
 }
Exemplo n.º 14
0
 public IWidget Create(string serialisedWidget)
 {
     return(MyWidget.Deserialize(serialisedWidget));
 }
Exemplo n.º 15
0
 public void AddChild(MyWidget child)
 {
     this.Children.Add(child);
 }