//**************************************** 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); }
public static int Main(String[] args) { new QApplication(args); MyWidget w = new MyWidget(); w.Show(); return QApplication.Exec(); }
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(); }
public static void Main(string[] args) { new QApplication(args); MyWidget main = new MyWidget((QWidget)null); main.Show(); QApplication.Exec(); }
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(); }
public static int Main(String[] args) { new QApplication(args); MyWidget w = new MyWidget(); w.Show(); return(QApplication.Exec()); }
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()); }
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)); } }
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(); }
public static void Main(string[] args) { new QApplication(args); MyWidget main = new MyWidget((QWidget)null); main.Show(); QApplication.Exec(); }
public MainViewModel() { Widget = new MyWidget(); }
public IWidget Create(string serialisedWidget) { return(MyWidget.Deserialize(serialisedWidget)); }
public void AddChild(MyWidget child) { this.Children.Add(child); }