void EnablePanel(ExampleEnum panelType) { foreach (var panel in Panels) { if (panel.Type == panelType) { EnablePanel(panel.gameObject); } } }
internal object CreateItem2(ExampleEnum e) { switch (e) { case e.Something: return(new blah()); default: return(new List <string>()); } }
public void InvalidEnumValueGivesInvalidEnumMessage() { const ExampleEnum invalidValue = (ExampleEnum)123; const string expectedMessage = "The value 123 is not valid for enum type 'ExhaustiveMatching.Tests.Fakes.ExampleEnum'. Match is supposed to be exhaustive."; var ex = ExhaustiveMatch.Failed(invalidValue); Assert.Equal(expectedMessage, ex.Message); Assert.Equal(invalidValue, ex.FailedValue); Assert.Equal(typeof(ExampleEnum), ex.MatchingType); }
/// <summary> /// A method with default parameters. /// </summary> public void DefaultParameters <T>(bool @bool = true, bool?no = false, bool?maybe = null, byte @byte = byte.MaxValue, sbyte @sbyte = sbyte.MaxValue, char @char = '\u1234', decimal @decimal = 3.14m, double @double = double.NaN, float @float = float.NegativeInfinity, int @int = -42, uint @uint = 42, long @long = long.MinValue, ulong @ulong = long.MaxValue, object @object = null, short @short = short.MinValue, ushort @ushort = ushort.MaxValue, string @string = "hi\0'\"\\\a\b\f\n\r\t\v\u0001\uABCD", T t = default(T), DateTime @virtual = default(DateTime), ExampleEnum @enum = ExampleEnum.One, ExampleFlagsEnum flags = ExampleFlagsEnum.Second | ExampleFlagsEnum.Third) { }
public void GetReadableValues_ReturnsCorrectList_ForEnum() { ExampleEnum testEnum = new ExampleEnum(); List <string> expectedStrings = new List <string>() { "First Entry", "Second Entry", "Third Entry", "Fourth Entry", "Thereshouldbenospacesbetweenthesewords" }; Assert.That(() => testEnum.GetReadableValues(), Is.EqualTo(expectedStrings)); }
public void ExampleEvent( Client sender, NetHandle currentVehicleHandle, string stringArgument, int intArgument, ExampleEnum enumArgument) { API.consoleOutput($@"== {nameof(ExampleEvent)} ==\n {nameof(sender)}: {sender.socialClubName}\n {nameof(currentVehicleHandle)}: {currentVehicleHandle.Value}\n {nameof(stringArgument)}: {stringArgument}\n {nameof(intArgument)}: {intArgument}\n {nameof(enumArgument)}: {enumArgument}" ); }
public GetResponse Get([FromQuery] int intValue, [FromQuery] float floatValue, [FromQuery] string stringValue, [FromQuery] DateTime dateValue, [FromQuery] ExampleEnum enumValue, [FromQuery] List <int> intList) { _logger.LogError("query string readed"); return(new GetResponse { IntValue = intValue, FloatValue = floatValue, StringValue = stringValue, DateValue = dateValue, EnumValue = enumValue, IntList = intList }); }
private void ExampleMethod(ExampleEnum test) { var exampleList = new List <string>(); var count = exampleList.Select(s => s.Equals("Test")).Count(); switch (test) { case ExampleEnum.None: break; case ExampleEnum.First: break; case ExampleEnum.Second: break; default: throw new ArgumentOutOfRangeException(nameof(test), test, null); } }
public void CombinationExample([Values] ExampleEnum enumValue, [ValueSource(nameof(Numbers))] int number, [Values] bool flag) { Assert.Pass(); }
public void ToEnum_ReturnsEnum(string input, ExampleEnum expectedResult) { var result = input.ToEnum <ExampleEnum>(); result.Should().Be(expectedResult); }
public async Task ChoiceExample(ExampleEnum input) { await RespondAsync(input.ToString()); }
public Task <ExampleEnum> EchoEnumAsync(ExampleEnum value) { return(Task.FromResult(value)); }
void Update() { BooleanValue = Mathf.Repeat(Time.time, 1.0f) > 0.5f; FloatValue = Mathf.PingPong(Time.realtimeSinceStartup, 1.0f); IntValue = Mathf.FloorToInt(FloatValue * 10.0f); Vector2Value = GetComponent <Rigidbody2D>().velocity; Vector3Value = transform.position; ColorValue = Color.Lerp(DebugGraph.DefaultBlue, new Color(1.0f, 0.75f, 0.25f), Mathf.PingPong(Time.realtimeSinceStartup, 1.0f)); Color32Value = ColorValue; StringValue = "Hello World! The Current Frame Number Is: " + Time.frameCount; EnumValue = (ExampleEnum)(Time.frameCount % 3); float sin = Mathf.Sin(Mathf.Repeat(Time.time, 6.28f)); float cos = Mathf.Cos(Mathf.Repeat(Time.time, 6.28f)); DebugGraph.Log("Color Gradient", ColorValue); DebugGraph.Write("String", StringValue); DebugGraph.Log("Vector3", Input.mousePosition); DebugGraph.Log("Vector4", new Vector4(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f))); transform.Rotate(Vector3.up, Time.deltaTime * 90.0f); DebugGraph.Log("Quaternion", transform.rotation); DebugGraph.Log("Rect", new Rect(0, 0, 100, 100)); DebugGraph.Draw(new Vector2(sin * Time.time, cos * Time.time)); DebugGraph.MultiLog("Related Variables", DebugGraph.DefaultRed, sin, "Sin"); DebugGraph.MultiLog("Related Variables", DebugGraph.DefaultGreen, cos, "Cos"); DebugGraph.Log(FloatValue); //Anonymous Float //Anonymous Multi Float DebugGraph.MultiLog(cos * 1.1f); DebugGraph.MultiLog(cos * 1.2f); DebugGraph.MultiLog(cos * 1.3f, "C"); //with Value names DebugGraph.MultiLog(cos * 1.4f, "D"); DebugGraph.MultiLog(cos * 1.5f, "E"); //Anonymous Values in a Loop for (int i = 0; i < 10; i++) { DebugGraph.MultiLog(DebugGraph.GetUniqueColor(i), sin * (1.0f + i * 0.1f), i.ToString()); } DebugGraph.Log(Mathf.FloorToInt(sin * 10)); //Anonymous Integer DebugGraph.Log(Mathf.RoundToInt(Mathf.PerlinNoise(Time.time, Time.time) * 1) > 0); //Anonymous Boolean //Anonymous Multi Enum DebugGraph.MultiLog(EnumValue); DebugGraph.MultiLog((ExampleEnum2)(Mathf.PerlinNoise(Time.time, Time.time) * 3)); }
public virtual void HandlerWithVariousParameters( string stringArgument, int intArgument, ExampleEnum enumArgument) { }
public void ThenTheResultShouldHaveValues(string value, string time, string nullableTime, string culture, ExampleEnum someEnum) { PocObject poc = this.scenarioContext.Get <PocObject>("Result"); var expected = new PocObject { SomeCulture = string.IsNullOrEmpty(culture) ? null : CultureInfo.GetCultureInfo(culture), SomeDateTime = DateTimeOffset.Parse(time), SomeNullableDateTime = string.IsNullOrEmpty(nullableTime) ? null : (DateTimeOffset?)DateTimeOffset.Parse(nullableTime), SomeEnum = someEnum, SomeValue = value }; Assert.AreEqual(expected, poc); }
public void GivenISerializeAPOCOWith(string value, string time, string nullableTime, string culture, ExampleEnum someEnum) { var poco = new PocObject { SomeCulture = string.IsNullOrEmpty(culture) ? null : CultureInfo.GetCultureInfo(culture), SomeDateTime = DateTimeOffset.Parse(time), SomeNullableDateTime = string.IsNullOrEmpty(nullableTime) ? null : (DateTimeOffset?)DateTimeOffset.Parse(nullableTime), SomeEnum = someEnum, SomeValue = value }; IJsonSerializerOptionsProvider settingsProvider = ContainerBindings.GetServiceProvider(this.featureContext).GetService <IJsonSerializerOptionsProvider>(); this.scenarioContext.Set(JsonSerializer.Serialize(poco, settingsProvider.Instance), "Result"); }
public void It_can_deserialize_nullable_enums(ExampleEnum? enum1expected, ExampleEnum? enum2expected, string[] args) { var obj = ConsoleApp.FromCommandLineArgs<ClassWithFieldsAndNoAttributes>(args); Assert.Equal(enum1expected, obj.NullableEnumField1); Assert.Equal(enum2expected, obj.NullableEnumField2); }
public ExampleStruct(int nr) : this() { this.Name = "Element " + nr; this.Number = nr; this.Enum = (ExampleEnum)ExampleHelper.RandomInt(0, 5); }
/// <summary> /// Gets the next enumerated value. /// </summary> public static ExampleEnum GetNext(this ExampleEnum value) { throw new NotImplementedException(); }
public void RangesAndRandoms([Values] ExampleEnum enumValue, [Range(0, 10)] int number, [Random(0.10, 0.99, 3)] decimal random) { Assert.Pass(); }