private bool Testing(TestEnum testEnum) { // Variable bool result = true; stringBuilder.Clear(); ITestInterface test = testsDictionary[testEnum].Item1; stringBuilder = test.Test(); // :( - Don't know why it is necessary if (consolePrint) { stringBuilder.AppendLine(); } if (consolePrint) { string template = testsDictionary[testEnum].Item2; string testString = stringBuilder.ToString(); // Because Windows and Unix template = template.Replace("\r\n", "\n"); testString = testString.Replace("\r\n", "\n"); if (template.Equals(testString)) { Console.WriteLine("OK " + testEnum.ToString()); result = true; } else { Console.WriteLine("NOK " + testEnum.ToString()); result = false; } } else { Directory.CreateDirectory(Path.GetDirectoryName(test.GetPath())); testPath = test.GetPath(); StreamWriter streamWriter = new StreamWriter(testPath); streamWriter.WriteLine(stringBuilder.ToString()); streamWriter.Flush(); } ReaderWriter.ReaderWriter.DeleteTestFile(); return(result); }
public static string Test02() { TestEnum a = (TestEnum)1; Console.WriteLine("a=" + a); return(a.ToString()); }
public void ToEnum_Test() { TestEnum target = TestEnum.A; var except = EnumHelper.ToEnum <TestEnum>(target.ToString()); Assert.AreEqual(target, except); }
public static int Main(string[] args) { TestEnum te = TestEnum.A; te.ToString(); return(1); }
public void ToString_ReturnsValue() { var test = new TestEnum("Test"); string testValue = test.ToString(); Assert.Equal(test.Value, testValue); }
public void Native() { // for flags is defined as follows if (decimal.TryParse(Value.ToString(), out _)) { throw new ArgumentException(); } }
public void EnumToString(TestEnum theEnum, string enumName) { Assert.Multiple(() => { Assert.That(theEnum.ToString(), Is.EqualTo(enumName)); Assert.That($"{theEnum}", Is.EqualTo(enumName)); }); }
protected override string Execute(string[] InArguments) { TestEnum EnumValue = (TestEnum)StringToEnum(InArguments[0], typeof(TestEnum)); ConsoleWindow.instance.AddMessage(EnumValue.ToString()); return(Done); }
public void GetDescriptionTest() { Assert.AreEqual <string>("TestEnumValue", EnumUtility.GetDescription(TestEnum.Value)); TestEnum none = (TestEnum)12345; Assert.AreEqual <string>(EnumUtility.GetDescription(none), none.ToString()); }
public static string Test01() { TestEnum a = TestEnum.Enum4; Console.WriteLine("a=" + a); return(a.ToString()); }
/// <summary> /// Gets the code stream. /// </summary> /// <param name="test">The test.</param> /// <returns></returns> public static Stream GetCodeStream(TestEnum test) { string testName = test.ToString() + ".n"; Stream codeStream = typeof(ParseHelper).Assembly.GetManifestResourceStream(test.GetType(), testName); Assert.IsNotNull(codeStream, String.Format(CultureInfo.CurrentCulture, Settings.Default.NotFoundCodeStream, testName)); return(codeStream); }
public void TryGetDescription_ValueNotDefined() { //Force a value that isn't defined TestEnum value = (TestEnum)0; string description = DescriptionResolver.TryGetDescription(value); Assert.AreEqual(description, value.ToString()); }
private void Start() { CursedDebugger.Instance.Add("int", () => intValue.ToString()); CursedDebugger.Instance.Add("float", () => floatValue.ToString(), Color.blue); CursedDebugger.Instance.Add("bool", () => boolValue.ToString()); CursedDebugger.Instance.Add("vector3", () => vector3value.ToString(), Color.green); CursedDebugger.Instance.Add("enum", () => enumValue.ToString()); CursedDebugger.Instance.Add("Test", () => intValue.ToString() + " !! " + floatValue.ToString()); }
public void TestUInt64ToString() { var flag1NativeToString = Flag1.ToString(); var flag2NativeToString = Flag2.ToString(); Flag1.AsString().ShouldBeEquivalentTo(Flag1StringValue); Flag2.AsString().ShouldBeEquivalentTo(flag2NativeToString); AllFlags.AsString().ShouldBeEquivalentTo(AllFlags.ToString()); (Flag2 | Flag10).ShouldBeEquivalentTo(Flag2Flag10StringValue); AllFlags.AsString().ShouldBeEquivalentTo(FlagsAllStringValue); }
public void TypeExtensions_ParseEnum_Returns_Expected_Enum_Value() { //setup TestEnum expected = TestEnum.SomeVal; string testVal = expected.ToString(); //act var actual = TypeExtensions.ParseEnum <TestEnum>(testVal); //assert Assert.AreEqual(expected, actual); }
public void TypeExtensions_ParseEnum_Returns_Default_Enum_Value_When_Input_is_Null() { //setup TestEnum expected = TestEnum.NotSet; string testVal = expected.ToString(); //act var actual = TypeExtensions.ParseEnum <TestEnum>(null); //assert Assert.AreEqual(expected, actual); }
public void ThrowsIfEnumPosReferencesAnotherType(TestEnum enumValue, int dummyValue) { // Arrange var a = enumValue.ToString().Length + dummyValue; // to use the enumValue and dummyValue, without this line, the project can not be compiled // this must be outside Assert.ThrowsException because input parameter Action is sometimes // considered as method so MethodBase.GetCurrentMethod inside the Action claims it has // no DataRowAttribute var callingMethod = MethodBase.GetCurrentMethod(); // Act+ Assert Assert.ThrowsException <InvalidCastException>( () => Assert.That.AllEnumValuesDefined <TestEnum>(callingMethod, 1)); }
public void EnumTestParam(TestEnum sw) { Console.WriteLine(sw.ToString()); }
static void Main(string[] args) { TestEnum testEnum = Enum.Parse <TestEnum>(GlobalConstants.NormalUserType); Console.WriteLine(testEnum.ToString("g")); }
public void EnumTest(TestEnum testEnu, int trala) { Console.WriteLine(testEnu.ToString()); }
/// <summary> /// Gets the code stream. /// </summary> /// <param name="test">The test.</param> /// <returns></returns> public static Stream GetCodeStream(TestEnum test) { string testName = test.ToString() + ".n"; Stream codeStream = typeof (ParseHelper).Assembly.GetManifestResourceStream(test.GetType(), testName); Assert.IsNotNull(codeStream, String.Format(CultureInfo.CurrentCulture, Settings.Default.NotFoundCodeStream, testName)); return codeStream; }
static string Test04Sub(TestEnum a) { return(a.ToString()); }
private Test(TestEnum testEnum) { Id = (int)testEnum; Description = testEnum.ToString(); }