public ImageWindow(string src) : base(src) { Decorated = false; KeepAbove = true; Resize (640, 240); Move (100, 100); //Opacity = 1.0; pixbuf = new Pixbuf (src); Gtk.Image image = new Gtk.Image (); image.Pixbuf = pixbuf; EventBox box = new EventBox (); box.Add (image); box.ButtonPressEvent += new ButtonPressEventHandler (WindowController.OnButtonDragPress); box.ExposeEvent += HandleMyWinExposeEvent; Add (box); WindowController.HandleMyWinScreenChanged(this, null); WindowController.SetWindowShapeFromPixbuf (this, image.Pixbuf); DestroyEvent += new DestroyEventHandler (delegate(object o, DestroyEventArgs args) { if(cr!=null){ ((IDisposable)cr).Dispose(); } }); ShowAll(); }
public async Task When_The_Event_Does_Not_Exist_Should_Return_Failure() { var eventRepository = new Mock <IEventRepository>(); Maybe <Event> maybeEvent = null; eventRepository.Setup(it => it.FindById(It.IsAny <Guid>())).Returns(Task.FromResult(maybeEvent)); var destroyEvent = new DestroyEvent(Guid.NewGuid()); var handler = new DestroyEventHandler(eventRepository.Object); Result result = await handler.Handle(destroyEvent, CancellationToken.None); Assert.True(result.IsFailure); }
public async Task Should_Return_Success() { var eventRepository = new Mock <IEventRepository>(); Maybe <Event> maybeEvent = new Event(Guid.NewGuid(), "Christmas", new DateTime(year: 2020, month: 6, day: 25)); var destroyEvent = new DestroyEvent(Guid.NewGuid()); eventRepository.Setup(it => it.FindById(It.IsAny <Guid>())).Returns(Task.FromResult(maybeEvent)); var handler = new DestroyEventHandler(eventRepository.Object); Result result = await handler.Handle(destroyEvent, CancellationToken.None); Assert.True(result.IsSuccess); }
public async Task When_The_Event_Is_Not_Removed_Should_Return_Failure() { var eventRepository = new Mock <IEventRepository>(); Maybe <Event> maybeEvent = new Event(Guid.NewGuid(), "Christmas", new DateTime(year: 2020, month: 6, day: 25)); eventRepository.Setup(it => it.FindById(It.IsAny <Guid>())).Returns(Task.FromResult(maybeEvent)); eventRepository.Setup(it => it.Remove(It.IsAny <Event>())).Returns(Task.FromResult(Result.Failure("Something has gone wrong..."))); var destroyEvent = new DestroyEvent(Guid.NewGuid()); var handler = new DestroyEventHandler(eventRepository.Object); Result result = await handler.Handle(destroyEvent, CancellationToken.None); Assert.True(result.IsFailure); }