public Component(ucss.uno.XComponentContext ctx, uno.Any[] args) { m_args = new Any[args.Length + 1]; m_args[0] = new Any(typeof(ucss.uno.XComponentContext), ctx); for (int i = 0; i < args.Length; i ++) { m_args[i+1] = args[i]; } }
/// <summary> /// Allows index operations on the array. /// </summary> /// <param name="i">Index position in the array.</param> /// <returns>The element in the specified position.</returns> public byte this[Any<int, long, uint, ulong> i] { get { return default(byte); } set { } }
/// <summary> /// Allows index operations on the array. /// </summary> /// <param name="i">Index position in the array.</param> /// <returns>The element in the specified position.</returns> public float this[Any<int, long, uint, ulong> i] { get { return default(float); } set { } }
/// <summary> /// Allows index operations on the array. /// </summary> /// <param name="i">Index position in the array.</param> /// <returns>The element in the specified position.</returns> public uint this[Any<int, long, uint, ulong> i] { get { return default(uint); } set { } }
/// <summary> /// Allows index operations on the array. /// </summary> /// <param name="i">Index position in the array.</param> /// <returns>The element in the specified position.</returns> public double this[Any<int, long, uint, ulong> i] { get { return default(double); } set { } }
/// <summary> /// Allows index operations on the array. /// </summary> /// <param name="i">Index position in the array.</param> /// <returns>The element in the specified position.</returns> public short this[Any<int, long, uint, ulong> i] { get { return default(short); } set { } }
public void Events_committed_to_the_event_store_are_caught_up_by_multiple_independent_read_model_stores() { var productName = Any.Paragraph(4); var projector1 = new Projector <Order.ItemAdded>(() => new ReadModels1DbContext()) { OnUpdate = (work, e) => new ReadModels1DbContext().DisposeAfter(db => UpdateReservedInventory(db, e)) }; var projector2 = new Projector <Order.ItemAdded>(() => new ReadModels2DbContext()) { OnUpdate = (work, e) => new ReadModels2DbContext().DisposeAfter(db => UpdateReservedInventory(db, e)) }; var numberOfEvents = Any.Int(10, 50); using (var disposables = new CompositeDisposable()) using (var catchup1 = CreateReadModelCatchup <ReadModels1DbContext>(projector1)) using (var catchup2 = CreateReadModelCatchup <ReadModels2DbContext>(projector2)) { catchup1.Progress.ForEachAsync(p => Console.WriteLine("catchup1: " + p)); catchup2.Progress.ForEachAsync(p => Console.WriteLine("catchup2: " + p)); Action <string, ThreadStart> startThread = (name, start) => { var thread = new Thread(() => { Console.WriteLine("starting thread (" + Thread.CurrentThread.ManagedThreadId + ")"); start(); Console.WriteLine("ended thread (" + Thread.CurrentThread.ManagedThreadId + ")"); }); thread.Name = name; thread.Start(); disposables.Add(Disposable.Create(thread.Abort)); }; Events.Write(numberOfEvents, i => new Order.ItemAdded { ProductName = productName, Quantity = 1, AggregateId = Any.Guid() }); // TODO: (Events_committed_to_the_event_store_are_caught_up_by_multiple_independent_read_model_stores) is this leading to intermittent test failures by leaving a dangling app lock? startThread("catchup1", () => { catchup1.Run(); catchup1.Dispose(); }); startThread("catchup2", () => { catchup2.Run(); catchup2.Dispose(); }); Console.WriteLine("Waiting on catchups to complete"); // wait on both catchups to complete catchup1 .Progress .Merge(catchup2.Progress) .Where(p => p.IsEndOfBatch) .Take(2) .Timeout(DefaultTimeout) .Wait(); } Action <DbContext> verify = db => { var readModelInfoName = ReadModelInfo.NameForProjector(projector1); var readModelInfos = db.Set <ReadModelInfo>(); Console.WriteLine(new { readModelInfos }.ToLogString()); readModelInfos .Single(i => i.Name == readModelInfoName) .CurrentAsOfEventId .Should() .Be(HighestEventId + numberOfEvents); var productInventories = db.Set <ProductInventory>(); Console.WriteLine(new { productInventories }.ToLogString()); productInventories .Single(pi => pi.ProductName == productName) .QuantityReserved .Should() .Be(numberOfEvents); }; Console.WriteLine("verifying ReadModels1DbContext..."); new ReadModels1DbContext().DisposeAfter(r => verify(r)); Console.WriteLine("verifying ReadModels2DbContext..."); new ReadModels2DbContext().DisposeAfter(r => verify(r)); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Any obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr); }
/// <summary> /// Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, /// only the pixels from that rectangle are painted. /// </summary> /// <param name="imagedata">An imageData object containing the array of pixel values.</param> /// <param name="dx"> /// Position offset in the target canvas context of the rectangle to be painted, relative to the /// rectangle in the origin image data. /// </param> /// <param name="dy"> /// Position offset in the target canvas context of the rectangle to be painted, relative to the /// rectangle in the origin image data. /// </param> /// <param name="dirtyX"> /// Position of the top left point of the rectangle to be painted, in the origin image data. /// Defaults to the top left of the whole image data. /// </param> /// <param name="dirtyY"> /// Position of the top left point of the rectangle to be painted, in the origin image data. /// Defaults to the top left of the whole image data. /// </param> /// <param name="dirtyWidth"> /// Width of the rectangle to be painted, in the origin image data. Defaults to the width of the image data. /// </param> /// <param name="dirtyHeight"> /// Height of the rectangle to be painted, in the origin image data. Defaults to the height of the image data. /// </param> public virtual void PutImageData(ImageData imagedata, int dx, int dy, Any<uint?, int?> dirtyX = null, Any<uint?, int?> dirtyY = null, Any<uint?, int?> dirtyWidth = null, Any<uint?, int?> dirtyHeight = null) { return; }
/// <summary> /// Draws (strokes) a given text at the given (x, y) position. /// </summary> /// <param name="text"> /// The text to render using the current font, textAlign, textBaseline, and direction values. /// </param> /// <param name="x">The x axis of the coordinate for the text starting point.</param> /// <param name="y">The y axis of the coordinate for the text starting point.</param> /// <param name="maxWidth"> /// The maximum width to draw. If specified, and the string is computed to be wider than /// this width, the font is adjusted to use a more horizontally condensed font (if one is /// available or if a reasonably readable one can be synthesized by scaling the current /// font horizontally) or a smaller font. /// </param> public virtual void StrokeText(string text, Any <uint, int> x, Any <uint, int> y, Any <uint?, int?> maxWidth = null) { return; }
/// <summary> /// Draws the specified image. This method is available in multiple formats, providing a great /// deal of flexibility in its use. /// </summary> /// <param name="image"> /// An element to draw into the context. The specification permits any canvas image source. /// </param> /// <param name="dx"> /// The X coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> /// <param name="dy"> /// The Y coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> /// <param name="dWidth"> /// The width to draw the image in the destination canvas. This allows scaling of the drawn image. /// If null, the image is not scaled in height when drawn. /// </param> /// <param name="dHeight"> /// The height to draw the image in the destination canvas. This allows scaling of the drawn image. /// If null, the image is not scaled in height when drawn. /// </param> public virtual void DrawImage(Any <ImageElement, VideoElement, CanvasElement, CanvasRenderingContext2D> image, Any <int, long, float, double> dx, Any <int, long, float, double> dy, Any <int?, long?, float?, double?> dWidth, Any <int?, long?, float?, double?> dHeight) { return; }
/// <summary> /// Paints a rectangle which has a starting point at (x, y) and has a w width and an h height /// onto the canvas, using the current stroke style. /// </summary> /// <param name="x">The x axis of the coordinate for the rectangle starting point.</param> /// <param name="y">The y axis of the coordinate for the rectangle starting point.</param> /// <param name="width">The rectangle's width.</param> /// <param name="height">The rectangle's height.</param> public virtual void StrokeRect(Any <uint, int> x, Any <uint, int> y, Any <uint, int> width, Any <uint, int> height) { return; }
/// <summary> /// Creates a pattern using the specified image (a CanvasImageSource). It repeats the source in the /// directions specified by the repetition argument. This method returns a CanvasPattern. /// </summary> /// <param name="image"> /// A CanvasImageSource to be used as image to repeat. It can either be a: /// • HTMLImageElement (<img>), /// • HTMLVideoElement (<video>), /// • HTMLCanvasElement (<canvas>), /// • CanvasRenderingContext2D, /// • ImageBitmap (c# object for now), /// • ImageData, or a /// • Blob. /// </param> /// <param name="repetition"></param> /// <returns>An opaque CanvasPattern object describing a pattern.</returns> /// <remarks> /// At the time of implementation, ImageBitmap had no documentation and Bridge.NET did not have /// it defined inside. /// </remarks> public virtual CanvasPattern CreatePattern( Any <ImageElement, VideoElement, CanvasElement, CanvasRenderingContext2D, object, ImageData, Blob> image, CanvasTypes.CanvasRepetitionTypes repetition) { return(null); }
/// <summary> /// Draws the specified image. This method is available in multiple formats, providing a great /// deal of flexibility in its use. /// </summary> /// <param name="image"> /// An element to draw into the context. The specification permits any canvas image source. /// </param> /// <param name="sx"> /// The X coordinate of the top left corner of the sub-rectangle of the source image to draw into /// the destination context. /// </param> /// <param name="sy"> /// The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into /// the destination context. /// </param> /// <param name="sWidth"> /// The width of the sub-rectangle of the source image to draw into the destination context. /// </param> /// <param name="sHeight"> /// The height of the sub-rectangle of the source image to draw into the destination context. /// </param> /// <param name="dx"> /// The X coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> /// <param name="dy"> /// The Y coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> /// <param name="dWidth"> /// The width to draw the image in the destination canvas. This allows scaling of the drawn image. /// If not specified or null, the image is not scaled in height when drawn. /// </param> /// <param name="dHeight"> /// The height to draw the image in the destination canvas. This allows scaling of the drawn image. /// If not specified or null, the image is not scaled in height when drawn. /// </param> public virtual void DrawImage(Any<ImageElement, VideoElement, CanvasElement, CanvasRenderingContext2D> image, Any<int, long, float, double> sx, Any<int, long, float, double> sy, Any<int?, long?, float?, double?> sWidth, Any<int?, long?, float?, double?> sHeight, Any<int, long, float, double> dx, Any<int, long, float, double> dy, Any<int?, long?, float?, double?> dWidth, Any<int?, long?, float?, double?> dHeight) { return; }
/// <summary> /// Draws the specified image. This method is available in multiple formats, providing a great /// deal of flexibility in its use. /// </summary> /// <param name="image"> /// An element to draw into the context. The specification permits any canvas image source. /// </param> /// <param name="dx"> /// The X coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> /// <param name="dy"> /// The Y coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> public virtual void DrawImage(Any<ImageElement, VideoElement, CanvasElement, CanvasRenderingContext2D> image, Any<int, long, float, double> dx, Any<int, long, float, double> dy) { return; }
/// <summary> /// Creates a radial gradient along the line given by the coordinates represented by the parameters. /// </summary> /// <param name="x0">The x axis of the coordinate of the start circle.</param> /// <param name="y0">The y axis of the coordinate of the start circle.</param> /// <param name="r0">The radius of the start circle.</param> /// <param name="x1">The x axis of the coordinate of the end circle.</param> /// <param name="y1">The y axis of the coordinate of the end circle.</param> /// <param name="r1">The radius of the end circle.</param> /// <returns>A radial CanvasGradient initialized with the two specified circles.</returns> public virtual CanvasGradient CreateRadialGradient( Any<uint, int, double> x0, Any<uint, int, double> y0, Any<uint, int, double> r0, Any<uint, int, double> x1, Any<uint, int, double> y1, Any<uint, int, double> r1) { return null; }
/// <summary> /// Creates a pattern using the specified image (a CanvasImageSource). It repeats the source in the /// directions specified by the repetition argument. This method returns a CanvasPattern. /// </summary> /// <param name="image"> /// A CanvasImageSource to be used as image to repeat. It can either be a: /// • HTMLImageElement (<img>), /// • HTMLVideoElement (<video>), /// • HTMLCanvasElement (<canvas>), /// • CanvasRenderingContext2D, /// • ImageBitmap (c# object for now), /// • ImageData, or a /// • Blob. /// </param> /// <param name="repetition"></param> /// <returns>An opaque CanvasPattern object describing a pattern.</returns> /// <remarks> /// At the time of implementation, ImageBitmap had no documentation and Bridge.NET did not have /// it defined inside. /// </remarks> public virtual CanvasPattern CreatePattern( Any<ImageElement, VideoElement, CanvasElement, CanvasRenderingContext2D, object, ImageData, Blob> image, CanvasTypes.CanvasRepetitionTypes repetition) { return null; }
/// <summary> /// Creates a linear gradient along the line given by the coordinates represented by the parameters. /// </summary> /// <param name="x0">The x axis of the coordinate of the start point.</param> /// <param name="y0">The y axis of the coordinate of the start point.</param> /// <param name="x1">The x axis of the coordinate of the end point.</param> /// <param name="y1">The y axis of the coordinate of the end point.</param> /// <returns>A linear CanvasGradient initialized with the specified line.</returns> public virtual CanvasGradient CreateLinearGradient(Any<uint, int, double> x0, Any<uint, int, double> y0, Any<uint, int, double> x1, Any<uint, int, double> y1) { return null; }
/// <summary> /// Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the /// new object are transparent black. /// </summary> /// <param name="width">The width to give the new ImageData object.</param> /// <param name="height">The height to give the new ImageData object.</param> /// <returns> /// A new ImageData object with the specified width and height. The new object is filled with /// transparent black pixels. /// </returns> public virtual ImageData CreateImageData(Any<uint, int> width, Any<uint, int> height) { return null; }
public async Task ShouldAllowReadingSavedNotes() { //GIVEN using var storage = new StorageAdapter(); var id = Any.Guid(); var savedNote = Any.Instance <CreateTodoRequestData>(); await storage.UserTodosDao.Save(id, savedNote, Any.CancellationToken()); //WHEN var(guid, title, content, immutableHashSet) = await storage.UserTodosDao.Load(id, Any.CancellationToken()); //THEN content.Should().Be(savedNote.Content); title.Should().Be(savedNote.Title); guid.Should().Be(id); immutableHashSet.Should().Equal(ImmutableHashSet <Guid> .Empty); }
/// <summary> /// Creates a linear gradient along the line given by the coordinates represented by the parameters. /// </summary> /// <param name="x0">The x axis of the coordinate of the start point.</param> /// <param name="y0">The y axis of the coordinate of the start point.</param> /// <param name="x1">The x axis of the coordinate of the end point.</param> /// <param name="y1">The y axis of the coordinate of the end point.</param> /// <returns>A linear CanvasGradient initialized with the specified line.</returns> public virtual CanvasGradient CreateLinearGradient(Any <uint, int, double> x0, Any <uint, int, double> y0, Any <uint, int, double> x1, Any <uint, int, double> y1) { return(null); }
/// <summary> /// Draws (fills) a given text at the given (x,y) position. /// </summary> /// <param name="text"> /// The text to render using the current font, textAlign, textBaseline, and direction values. /// </param> /// <param name="x">The x axis of the coordinate for the text starting point.</param> /// <param name="y">The y axis of the coordinate for the text starting point.</param> public virtual void FillText(string text, Any<uint, int> x, Any<uint, int> y) { return; }
/// <summary> /// Reports whether or not the specified point is inside the area contained by the stroking of a path. /// </summary> /// <param name="path">A Path2D path to use.</param> /// <param name="x">The X coordinate of the point to check.</param> /// <param name="y">The Y coordinate of the point to check.</param> /// <returns> /// A Boolean, which is true if the point is inside the area contained by the stroking of a path, /// otherwise false. /// </returns> public virtual bool IsPointInStroke(Path2D path, Any <uint, int, double> x, Any <uint, int, double> y) { return(false); }
/// <summary> /// Returns an ImageData object representing the underlying pixel data for the area of the canvas /// denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height. /// </summary> /// <param name="sx"> /// The x axis of the coordinate for the rectangle startpoint from which the ImageData will be extracted. /// </param> /// <param name="sy"> /// The y axis of the coordinate for the rectangle endpoint from which the ImageData will be extracted. /// </param> /// <param name="sw"> /// The width of the rectangle from which the ImageData will be extracted. /// </param> /// <param name="sh"> /// The height of the rectangle from which the ImageData will be extracted. /// </param> /// <returns></returns> public virtual ImageData GetImageData(Any<uint, int> sx, Any<uint, int> sy, Any<uint, int> sw, Any<uint, int> sh) { return null; }
/// <summary> /// Resets the current transform to the identity matrix, and then invokes the transform() /// method with the same arguments. /// Matrix is described by a 3x3 [ a c e // b d f // 0 0 1 ] (// means a matrix line break). /// </summary> /// <param name="a">m11: Horizontal scaling.</param> /// <param name="b">m12: Horizontal skewing.</param> /// <param name="c">m21: Vertical skewing.</param> /// <param name="d">m22: Vertical scaling.</param> /// <param name="e">dx: Horizontal moving.</param> /// <param name="f">dy: Vertical moving.</param> public virtual void SetTransfrom(Any <int, double> a, Any <int, double> b, Any <int, double> c, Any <int, double> d, Any <int, double> e, Any <int, double> f) { return; }
/// <summary> /// Reports whether or not the specified point is contained in the current path. /// </summary> /// <param name="x">The X coordinate of the point to check.</param> /// <param name="y">The Y coordinate of the point to check.</param> /// <returns> /// A Boolean, which is true if the specified point is contained in the current or specfied path, /// otherwise false. /// </returns> public virtual bool IsPointInPath(Any<uint, int, double> x, Any<uint, int, double> y) { return false; }
/// <summary> /// Returns an ImageData object representing the underlying pixel data for the area of the canvas /// denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height. /// </summary> /// <param name="sx"> /// The x axis of the coordinate for the rectangle startpoint from which the ImageData will be extracted. /// </param> /// <param name="sy"> /// The y axis of the coordinate for the rectangle endpoint from which the ImageData will be extracted. /// </param> /// <param name="sw"> /// The width of the rectangle from which the ImageData will be extracted. /// </param> /// <param name="sh"> /// The height of the rectangle from which the ImageData will be extracted. /// </param> /// <returns></returns> public virtual ImageData GetImageData(Any <uint, int> sx, Any <uint, int> sy, Any <uint, int> sw, Any <uint, int> sh) { return(null); }
/// <summary> /// Reports whether or not the specified point is contained in the current path. /// </summary> /// <param name="path">A Path2D path to use.</param> /// <param name="x">The X coordinate of the point to check.</param> /// <param name="y">The Y coordinate of the point to check.</param> /// <param name="fillRule"> /// The algorithm by which to determine if a point is inside a path or outside a path. /// </param> /// <returns> /// A Boolean, which is true if the specified point is contained in the current or specfied path, /// otherwise false. /// </returns> public virtual bool IsPointInPath(Path2D path, Any<uint, int, double> x, Any<uint, int, double> y, CanvasTypes.CanvasFillRule? fillRule) { return false; }
/// <summary> /// Reports whether or not the specified point is inside the area contained by the stroking of a path. /// </summary> /// <param name="path">A Path2D path to use.</param> /// <param name="x">The X coordinate of the point to check.</param> /// <param name="y">The Y coordinate of the point to check.</param> /// <returns> /// A Boolean, which is true if the point is inside the area contained by the stroking of a path, /// otherwise false. /// </returns> public virtual bool IsPointInStroke(Path2D path, Any<uint, int, double> x, Any<uint, int, double> y) { return false; }
/// <summary> /// Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, /// only the pixels from that rectangle are painted. /// </summary> /// <param name="imagedata">An imageData object containing the array of pixel values.</param> /// <param name="dx"> /// Position offset in the target canvas context of the rectangle to be painted, relative to the /// rectangle in the origin image data. /// </param> /// <param name="dy"> /// Position offset in the target canvas context of the rectangle to be painted, relative to the /// rectangle in the origin image data. /// </param> /// <param name="dirtyX"> /// Position of the top left point of the rectangle to be painted, in the origin image data. /// Defaults to the top left of the whole image data. /// </param> /// <param name="dirtyY"> /// Position of the top left point of the rectangle to be painted, in the origin image data. /// Defaults to the top left of the whole image data. /// </param> /// <param name="dirtyWidth"> /// Width of the rectangle to be painted, in the origin image data. Defaults to the width of the image data. /// </param> /// <param name="dirtyHeight"> /// Height of the rectangle to be painted, in the origin image data. Defaults to the height of the image data. /// </param> public virtual void PutImageData(ImageData imagedata, int dx, int dy, Any<uint?, int?> dirtyX, Any<uint?, int?> dirtyY, Any<uint?, int?> dirtyWidth, Any<uint?, int?> dirtyHeight) { return; }
public static T ConvertFromAnyAsync <T>(Any any, JsonSerializerOptions options = null) { var utf8String = any.Value.ToStringUtf8(); return(JsonSerializer.Deserialize <T>(utf8String, options)); }
/// <summary> /// Adds a scaling transformation to the canvas units by x horizontally and by y vertically. /// </summary> /// <param name="x">Scaling factor in the horizontal direction.</param> /// <param name="y">Scaling factor in the vertical direction.</param> public virtual void Scale(Any<int, double> x, Any<int, double> y) { return; }
public unsafe static void __Process( [Output] ref Any Fun_with_ANY, [Input, DataType("ANY_NUM")] ref Any VALUE, [Input, DataType("ANY_NUM")] ref Any MIN, [Input, DataType("ANY_NUM")] ref Any MAX) { // Important due to unsafe programming: // Check whether all parameters have the same data type!!! if (VALUE.pRuntimeTypeHandle != Fun_with_ANY.pRuntimeTypeHandle || VALUE.pRuntimeTypeHandle != MIN.pRuntimeTypeHandle || VALUE.pRuntimeTypeHandle != MAX.pRuntimeTypeHandle) { return; } Eclr.TypeCode code; // Get the element type constants associate to the runtime type handle. // The values are defined in the standard ECMA-335 "Common Language Infrastructure (CLI)", // Partition II, chapter II.23.1.16 "Element types used in signatures") code = (Eclr.TypeCode)Eclr.TypeInfo.GetTypeCode(VALUE.pRuntimeTypeHandle); // type dependent action if (code == Eclr.TypeCode.Int16) // i2 { short tempValue = *((short *)VALUE.pValue); short tempMin = *((short *)MIN.pValue); short tempMax = *((short *)MAX.pValue); short *pResult = (short *)Fun_with_ANY.pValue; if (tempValue < tempMin) { tempValue = tempMin; } if (tempValue > tempMax) { tempValue = tempMax; } *pResult = tempValue; } else if (code == Eclr.TypeCode.UInt16) // u2 { ushort tempValue = *((ushort *)VALUE.pValue); ushort tempMin = *((ushort *)MIN.pValue); ushort tempMax = *((ushort *)MAX.pValue); ushort *pResult = (ushort *)Fun_with_ANY.pValue; if (tempValue < tempMin) { tempValue = tempMin; } if (tempValue > tempMax) { tempValue = tempMax; } *pResult = tempValue; } else if (code == Eclr.TypeCode.Int32) // i4 { int tempValue = *((int *)VALUE.pValue); int tempMin = *((int *)MIN.pValue); int tempMax = *((int *)MAX.pValue); int *pResult = (int *)Fun_with_ANY.pValue; if (tempValue < tempMin) { tempValue = tempMin; } if (tempValue > tempMax) { tempValue = tempMax; } *pResult = tempValue; } else if (code == Eclr.TypeCode.UInt32) // u4 { uint tempValue = *((uint *)VALUE.pValue); uint tempMin = *((uint *)MIN.pValue); uint tempMax = *((uint *)MAX.pValue); uint *pResult = (uint *)Fun_with_ANY.pValue; if (tempValue < tempMin) { tempValue = tempMin; } if (tempValue > tempMax) { tempValue = tempMax; } *pResult = tempValue; } else { // ... } }
/// <summary> /// Sets the current line dash pattern. /// </summary> /// <param name="segments"> /// An Array. A list of numbers that specifies distances to alternately draw a line and a gap /// (in coordinate space units). If the number of elements in the array is odd, the elements /// of the array get copied and concatenated. /// For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. /// </param> public virtual void SetLineDash(Any<double[], uint[], int[], IEnumerable<Any<double, uint, int>>> segments) { return; }
public void When_a_catchup_has_been_waiting_for_several_poll_intervals_it_only_runs_once() { // arrange int numberOfEventsToWrite = Any.Int(10, 20); Events.Write(numberOfEventsToWrite); var testScheduler = new TestScheduler(); var projector1 = new Projector <IEvent>(() => new ReadModels1DbContext()) { OnUpdate = (work, e) => { // create some delay so that catchup2 will attempt to poll multiple times testScheduler.Sleep(1000); } }; var projector2 = new Projector <IEvent>(() => new ReadModels1DbContext()); var catchup1StatusReports = new List <ReadModelCatchupStatus>(); var catchup2StatusReports = new List <ReadModelCatchupStatus>(); using (var catchup1 = CreateReadModelCatchup <ReadModels1DbContext>(projector1)) using (var catchup2 = CreateReadModelCatchup <ReadModels1DbContext>(projector2)) { bool catchup1Disposed = false; catchup1.Progress.ForEachAsync(s => { catchup1StatusReports.Add(s); Console.WriteLine("catchup1: " + s); // when the batch is done, dispose, which should allow catchup2 to try if (s.IsEndOfBatch) { Console.WriteLine("disposing catchup1"); catchup1.Dispose(); catchup1Disposed = true; } }); catchup2.Progress.ForEachAsync(s => { catchup2StatusReports.Add(s); Console.WriteLine("catchup2: " + s); }); // act var scheduler1 = new SchedulerWatcher(testScheduler, "scheduler1"); catchup1.PollEventStore(TimeSpan.FromSeconds(1), scheduler1); var scheduler2 = new SchedulerWatcher(testScheduler, "scheduler2"); scheduler2.Schedule(TimeSpan.FromSeconds(1.5), () => { Console.WriteLine("catchup2 polling starting"); // use a higher poll frequency so the poll timer fires many times while catchup1 is running catchup2.PollEventStore(TimeSpan.FromSeconds(.5), scheduler2); }); while (!catchup1Disposed) { testScheduler.AdvanceBy(TimeSpan.FromSeconds(.1).Ticks); } testScheduler.AdvanceBy(TimeSpan.FromSeconds(1).Ticks); } // assert catchup2StatusReports.Count(s => s.IsStartOfBatch) .Should() .Be(1); }
/// <summary> /// Paints a rectangle which has a starting point at (x, y) and has a w width and an h height /// onto the canvas, using the current stroke style. /// </summary> /// <param name="x">The x axis of the coordinate for the rectangle starting point.</param> /// <param name="y">The y axis of the coordinate for the rectangle starting point.</param> /// <param name="width">The rectangle's width.</param> /// <param name="height">The rectangle's height.</param> public virtual void StrokeRect(Any<uint, int> x, Any<uint, int> y, Any<uint, int> width, Any<uint, int> height) { return; }
/// <summary> /// Sets the current line dash pattern. /// </summary> /// <param name="segments"> /// An Array. A list of numbers that specifies distances to alternately draw a line and a gap /// (in coordinate space units). If the number of elements in the array is odd, the elements /// of the array get copied and concatenated. /// For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. /// </param> public virtual void SetLineDash(Any <double[], uint[], int[], IEnumerable <Any <double, uint, int> > > segments) { return; }
/// <summary> /// Draws (strokes) a given text at the given (x, y) position. /// </summary> /// <param name="text"> /// The text to render using the current font, textAlign, textBaseline, and direction values. /// </param> /// <param name="x">The x axis of the coordinate for the text starting point.</param> /// <param name="y">The y axis of the coordinate for the text starting point.</param> public virtual void StrokeText(string text, Any<uint, int> x, Any<uint, int> y) { return; }
/// <summary> /// Creates a radial gradient along the line given by the coordinates represented by the parameters. /// </summary> /// <param name="x0">The x axis of the coordinate of the start circle.</param> /// <param name="y0">The y axis of the coordinate of the start circle.</param> /// <param name="r0">The radius of the start circle.</param> /// <param name="x1">The x axis of the coordinate of the end circle.</param> /// <param name="y1">The y axis of the coordinate of the end circle.</param> /// <param name="r1">The radius of the end circle.</param> /// <returns>A radial CanvasGradient initialized with the two specified circles.</returns> public virtual CanvasGradient CreateRadialGradient( Any <uint, int, double> x0, Any <uint, int, double> y0, Any <uint, int, double> r0, Any <uint, int, double> x1, Any <uint, int, double> y1, Any <uint, int, double> r1) { return(null); }
/// <summary> /// Draws (strokes) a given text at the given (x, y) position. /// </summary> /// <param name="text"> /// The text to render using the current font, textAlign, textBaseline, and direction values. /// </param> /// <param name="x">The x axis of the coordinate for the text starting point.</param> /// <param name="y">The y axis of the coordinate for the text starting point.</param> /// <param name="maxWidth"> /// The maximum width to draw. If specified, and the string is computed to be wider than /// this width, the font is adjusted to use a more horizontally condensed font (if one is /// available or if a reasonably readable one can be synthesized by scaling the current /// font horizontally) or a smaller font. /// </param> public virtual void StrokeText(string text, Any<uint, int> x, Any<uint, int> y, Any<uint?, int?> maxWidth) { return; }
/// <summary> /// Reports whether or not the specified point is contained in the current path. /// </summary> /// <param name="path">A Path2D path to use.</param> /// <param name="x">The X coordinate of the point to check.</param> /// <param name="y">The Y coordinate of the point to check.</param> /// <param name="fillRule"> /// The algorithm by which to determine if a point is inside a path or outside a path. /// </param> /// <returns> /// A Boolean, which is true if the specified point is contained in the current or specfied path, /// otherwise false. /// </returns> public virtual bool IsPointInPath(Path2D path, Any <uint, int, double> x, Any <uint, int, double> y, CanvasTypes.CanvasFillRule?fillRule = null) { return(false); }
/* * Transformation matrix is described by: * [ a c e ] * [ b d f ] * [ 0 0 1 ] */ /// <summary> /// Multiplies the current transformation matrix with the matrix described by its arguments. /// Matrix is described by a 3x3 [ a c e // b d f // 0 0 1 ] (// means a matrix line break). /// </summary> /// <param name="a">m11: Horizontal scaling.</param> /// <param name="b">m12: Horizontal skewing.</param> /// <param name="c">m21: Vertical skewing.</param> /// <param name="d">m22: Vertical scaling.</param> /// <param name="e">dx: Horizontal moving.</param> /// <param name="f">dy: Vertical moving.</param> public virtual void Transform(Any<int, double> a, Any<int, double> b, Any<int, double> c, Any<int, double> d, Any<int, double> e, Any<int, double> f) { return; }
/// <summary> /// Adds a scaling transformation to the canvas units by x horizontally and by y vertically. /// </summary> /// <param name="x">Scaling factor in the horizontal direction.</param> /// <param name="y">Scaling factor in the vertical direction.</param> public virtual void Scale(Any <int, double> x, Any <int, double> y) { return; }
/// <summary> /// Adds a translation transformation by moving the canvas and its origin x horizontally and /// y vertically on the grid. /// </summary> /// <param name="x">Distance to move in the horizontal direction.</param> /// <param name="y">Distance to move in the vertical direction.</param> public virtual void Translate(Any<int, double> x, Any<int, double> y) { return; }
/// <summary> /// Adds a translation transformation by moving the canvas and its origin x horizontally and /// y vertically on the grid. /// </summary> /// <param name="x">Distance to move in the horizontal direction.</param> /// <param name="y">Distance to move in the vertical direction.</param> public virtual void Translate(Any <int, double> x, Any <int, double> y) { return; }
/// <summary> /// Sets route definition that will be used on route change when no /// other route definition is matched. /// </summary> /// <param name="parms"> /// Mapping information to be assigned to $route.current. If called with /// a string, the value maps to redirectTo. /// </param> public RouteProvider Otherwise(Any<String, MappingInformation> parms) { return default(RouteProvider); }
/// <summary> /// Draws the specified image. This method is available in multiple formats, providing a great /// deal of flexibility in its use. /// </summary> /// <param name="image"> /// An element to draw into the context. The specification permits any canvas image source. /// </param> /// <param name="dx"> /// The X coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> /// <param name="dy"> /// The Y coordinate in the destination canvas at which to place the top-left corner of the source image. /// </param> public virtual void DrawImage(Any <ImageElement, VideoElement, CanvasElement, CanvasRenderingContext2D> image, Any <int, long, float, double> dx, Any <int, long, float, double> dy) { return; }
public ItemBuilder() { WithBrandName(Any.StringOfLength(100)); WithName(Any.StringOfLength(50)); PopulateDefaultValues(); }
// See also the ImageData object. #region Pixel Manipulation /// <summary> /// Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the /// new object are transparent black. /// </summary> /// <param name="width">The width to give the new ImageData object.</param> /// <param name="height">The height to give the new ImageData object.</param> /// <returns> /// A new ImageData object with the specified width and height. The new object is filled with /// transparent black pixels. /// </returns> public virtual ImageData CreateImageData(Any <uint, int> width, Any <uint, int> height) { return(null); }
// method: determine whether this body player is currently collided with terrain // public static bool collidedWithTerrain() => Any.itemsIn(collidedTerrains);
/// <summary> /// Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, /// only the pixels from that rectangle are painted. /// </summary> /// <param name="imagedata">An imageData object containing the array of pixel values.</param> /// <param name="dx"> /// Position offset in the target canvas context of the rectangle to be painted, relative to the /// rectangle in the origin image data. /// </param> /// <param name="dy"> /// Position offset in the target canvas context of the rectangle to be painted, relative to the /// rectangle in the origin image data. /// </param> /// <param name="dirtyX"> /// Position of the top left point of the rectangle to be painted, in the origin image data. /// Defaults to the top left of the whole image data. /// </param> /// <param name="dirtyY"> /// Position of the top left point of the rectangle to be painted, in the origin image data. /// Defaults to the top left of the whole image data. /// </param> /// <param name="dirtyWidth"> /// Width of the rectangle to be painted, in the origin image data. Defaults to the width of the image data. /// </param> /// <param name="dirtyHeight"> /// Height of the rectangle to be painted, in the origin image data. Defaults to the height of the image data. /// </param> public virtual void PutImageData(ImageData imagedata, int dx, int dy, Any <uint?, int?> dirtyX = null, Any <uint?, int?> dirtyY = null, Any <uint?, int?> dirtyWidth = null, Any <uint?, int?> dirtyHeight = null) { return; }
public async Task Posting_an_invalid_create_command_returns_400_Bad_request() { var testApi = new TestApi <Order>(); var response = await testApi.GetClient() .PostAsJsonAsync(string.Format("http://contoso.com/orders/createorder/{0}", Any.Guid()), new object()); response.ShouldFailWith(HttpStatusCode.BadRequest); }
public void ToString_Empty() { var any = new Any(); Assert.AreEqual("{ \"@type\": \"\", \"@value\": \"\" }", any.ToString()); }
/// <summary> /// Creates a new Int16Array of the specified length. /// </summary> /// <param name="length">Length of array to create</param> public Int16Array(Any<int, long, uint, ulong> length) { }
public async Task When_a_scheduled_command_fails_due_to_a_concurrency_exception_then_commands_that_its_handler_scheduled_are_not_duplicated() { var order = CommandSchedulingTests_EventSourced.CreateOrder(); await Save(new CustomerAccount(order.CustomerId).Apply(new ChangeEmailAddress(Any.Email()))); await Save(order); TriggerConcurrencyExceptionOnOrderCommands(order.Id); await Schedule(order.Id, new Cancel()); for (var i = 1; i < 3; i++) { await AdvanceClock(by : TimeSpan.FromDays(1)); } StopTriggeringConcurrencyExceptions(); await AdvanceClock(by : TimeSpan.FromDays(1)); await SchedulerWorkComplete(); var customer = await Get <CustomerAccount>(order.CustomerId); customer.Events() .OfType <CustomerAccount.OrderCancelationConfirmationEmailSent>() .Count() .Should() .Be(1); }
public async Task Posting_a_second_constructor_command_with_the_same_aggregate_id_results_in_a_409_Conflict() { // arrange var testApi = new TestApi <Order>(); var orderId = Any.Guid(); await testApi.GetClient() .PostAsJsonAsync($"http://contoso.com/orders/createorder/{orderId}", new CreateOrder(Any.FullName())); // act var response = await testApi.GetClient() .PostAsJsonAsync($"http://contoso.com/orders/createorder/{orderId}", new CreateOrder(Any.FullName())); // assert response.ShouldFailWith(HttpStatusCode.Conflict); }
// method: determine whether this body player is currently collided with ground // public static bool collidedWithGround() => Any.itemsIn(collidedGroundTerrains);
public void Message_ThrowsOnInsertingNegativeIndex() { var message = Message.Parse(ExampleMessageRepository.Minimum); message.Insert(-2, Any.String()); }
/// <summary> /// Creates a new Uint32Array of the specified length. /// </summary> /// <param name="length">Length of array to create</param> public Uint32Array(Any<int, long, uint, ulong> length) { }
public void Message_ThrowsWithIncorrectFirstSegment() { Message.Parse(Any.String()); }