void OnCollisionStay2D(Collision2D collision) { // Player Greek zorba = collision.gameObject.GetComponent <Greek>(); if (zorba != null && state == GreekState.DASHING) { zorba.shock(); nextForce = Vector3.zero; } // Element MachineElement element = collision.gameObject.GetComponent <MachineElement>(); if (element != null) { // thrown element ? if (element.getState() == ElementState.THROWN) { if (element.getThrower() != this) { shock(); } } else if (possession == null && state != GreekState.SHOCKED) { element.setOwner(this); possession = element; } } }
public Greek EnumParse() { Greek e = Greek.None; if (UseValid) { foreach (string s in ValidValues) { if (!Enum.TryParse(s, IgnoreCase, out e)) { throw new Exception("Invalid."); } } } else { foreach (string s in InvalidValues) { if (Enum.TryParse(s, IgnoreCase, out e)) { throw new Exception("Valid."); } } } return(e); }
//define a trigger event private void Submit_Click(object sender, RoutedEventArgs e) { //catch the exception try { SO = Convert.ToDouble(this.So.Text); K = Convert.ToDouble(this.k.Text); sigma = Convert.ToDouble(this.Sigma.Text); r = Convert.ToDouble(this.R.Text); T = Convert.ToDouble(this.Tenor.Text); TrailNum = Convert.ToInt32(this.Trail.Text); StepNum = Convert.ToInt32(this.Step.Text); double[,] Randoms = RandomNum.RandomSet(TrailNum, StepNum); double[] EurpCall = EuropOption.PriceEurp(SO, K, sigma, r, T, StepNum, TrailNum, Randoms); double[] GreekValue = Greek.Greeks(SO, K, sigma, r, T, StepNum, TrailNum, Randoms); string OutPut; //output the results OutPut = Convert.ToString("EurCallprice : " + EurpCall[0] + "\n" + "EurPutprice : " + EurpCall[1] + "\n" + "EurCallStdEr : " + EurpCall[2] + "\n" + "EurPutStdEr : " + EurpCall[3] + "\n" + "EurCallDelta : " + GreekValue[0] + "\n" + "EurPutDelta : " + GreekValue[1] + "\n" + "EurCallGamma : " + GreekValue[2] + "\n" + "EurPutGamma : " + GreekValue[3] + "\n" + "EurCallVega : " + GreekValue[4] + "\n" + "EurPutVega : " + GreekValue[5] + "\n" + "EurCallTheta : " + GreekValue[6] + "\n" + "EurPutTheta : " + GreekValue[7] + "\n" + "EurCallRho : " + GreekValue[8] + "\n" + "EurPutRho : " + GreekValue[9]); MessageBox.Show(OutPut); } catch (Exception) { MessageBox.Show("All the inputs need to be numbers."); } }
public void Helpers_getOpenForm_Test() { Helpers testHelpers = new Helpers(); MainKeyboard testMainKeyboard = new MainKeyboard(); Greek testGreek = new Greek(); testGreek.openFormForTest(); testGreek.setTempForm(); SetTheory_Logic testSetTheory = new SetTheory_Logic(); testSetTheory.openFormForTest(); testSetTheory.setTempForm(); Form testForm = new Form(); // Creating a Form object with no name, getOpenForms can not possibly return matching name when this object is passed in // as an argument and there are no open forms. ie if no forms are open , getOpenforms will return this object, whose name is null Form GreekTest = testHelpers.getOpenForm(testForm, "Greek"); Form MainKeyboardTest = testHelpers.getOpenForm(testForm, "MainKeyboard"); Form SetTheoryTest = testHelpers.getOpenForm(testForm, "SetTheory_Logic"); Assert.AreEqual(testGreek.Name, GreekTest.Name); Assert.AreEqual(testMainKeyboard.Name, MainKeyboardTest.Name); Assert.AreEqual(testSetTheory.Name, SetTheoryTest.Name); }
public void setOwner(Greek owner) { this.owner = owner; thrower = null; elementBody.isKinematic = true; elementCollider.enabled = false; transform.parent = owner.transform; transform.position = owner.getHeadPosition(); }
static void CheckImplicitCaseIgnored(EnumValueCaseIgnored <Greek> value, Greek expected) { Assert.Equal(expected, value); Assert.True(value == expected); Assert.True(value.Equals(expected)); Assert.True(value == new EnumValue <Greek>(expected)); Assert.False(value != expected); Assert.False(value != new EnumValue <Greek>(expected)); }
public void thrown(Vector2 force, Vector3 position) { state = ElementState.THROWN; thrower = owner; owner = null; transform.parent = null; elementBody.isKinematic = false; elementCollider.enabled = true; transform.position = position; elementBody.AddForce(force); }
// Update is called once per frame void Update() { if (elementBody.velocity.magnitude <= 2) { state = ElementState.NORMAL; } if (elementBody.velocity.magnitude <= 0) { thrower = null; } }
public void Greek_ButtonClick_Test() { Greek testGreek = new Greek(); testGreek.openFormForTest(); testGreek.setTempForm(); EventArgs e = new EventArgs(); testGreek.button1_Click(testGreek.Phi_Upper, e); String testString = testGreek.tempText; String testString2 = testGreek.Phi_Upper.Text; Assert.AreEqual(testString, testString2); }
public void ReturnsWordsInAlphabeticalOrder1() { // Arrange var sut = new Greek(); // Act var actual = sut.Sort(new List <string> { "Beta", "Alpha" }); // Assert // We could assert individually, but this would rapidly get annoying Assert.AreEqual("Alpha", actual[0]); Assert.AreEqual("Beta", actual[1]); }
public void ReturnsWordsInAlphabeticalOrder3() { // Arrange var sut = new Greek(); // Act var actual = sut.Sort(new List <string> { "Beta", "Alpha" }); // Assert // Fluent assertion is both more robust and much more readable. var expected = new List <string> { "Alpha", "Beta" }; actual.Should().BeEquivalentTo(expected, options => options.WithStrictOrdering()); }
//define a trigger event private void Submit_Click(object sender, RoutedEventArgs e) { watch.Start(); //catch the exception try { SO = Convert.ToDouble(this.So.Text); K = Convert.ToDouble(this.k.Text); sigma = Convert.ToDouble(this.Sigma.Text); r = Convert.ToDouble(this.R.Text); T = Convert.ToDouble(this.Tenor.Text); TrailNum = Convert.ToInt32(this.Trail.Text); StepNum = Convert.ToInt32(this.Step.Text); Anti = Convert.ToInt32(this.AntiOrNot.Text); Divident = Convert.ToDouble(this.Div.Text); DeltaBase = Convert.ToInt32(this.deltabased.Text); MultiThread = Convert.ToInt32(this.Multithread.Text); double[,] Randoms; if (MultiThread == 1) { Randoms = RandomNum.RandomSetMulti(TrailNum, StepNum); } else { Randoms = RandomNum.RandomSetMulti1(TrailNum, StepNum); } increase(1); double[] EurpCall = EuropOption.PriceEurp(SO, K, sigma, r, T, StepNum, TrailNum, Randoms, Anti, Divident, DeltaBase, MultiThread); double[] GreekValue = Greek.Greeks(SO, K, sigma, r, T, StepNum, TrailNum, Randoms, Anti, Divident, DeltaBase, MultiThread); string OutPut; //output the results watch.Stop(); OutPut = Convert.ToString("EurCallprice : " + EurpCall[0] + "\n" + "EurPutprice : " + EurpCall[1] + "\n" + "EurCallStdEr : " + EurpCall[2] + "\n" + "EurPutStdEr : " + EurpCall[3] + "\n" + "EurCallDelta : " + GreekValue[0] + "\n" + "EurPutDelta : " + GreekValue[1] + "\n" + "EurCallGamma : " + GreekValue[2] + "\n" + "EurPutGamma : " + GreekValue[3] + "\n" + "EurCallVega : " + GreekValue[4] + "\n" + "EurPutVega : " + GreekValue[5] + "\n" + "EurCallTheta : " + GreekValue[6] + "\n" + "EurPutTheta : " + GreekValue[7] + "\n" + "EurCallRho : " + GreekValue[8] + "\n" + "EurPutRho : " + GreekValue[9] + "\n" + "Timer : " + watch.Elapsed.TotalSeconds.ToString() + "\n" + "Cores : " + cores); MessageBox.Show(OutPut); } catch (Exception) { MessageBox.Show("All the inputs need to be numbers."); } }
public void ReturnsWordsInAlphabeticalOrder2() { // Arrange var sut = new Greek(); // Act var actual = sut.Sort(new List <string> { "Beta", "Alpha" }); // Assert // maybe we should write a loop, but what happens if "actual" has fewer items // than "expected", or even worse, "actual" has more? var expected = new List <string> { "Alpha", "Beta" }; for (int i = 0; i < expected.Count; i++) { Assert.AreEqual(expected[i], actual[i]); } }
public void TestPositiveCategories() { Assert.AreEqual(UppercaseLetter.ToString(), UnicodeCategory(Categories.UppercaseLetter).ToString()); Assert.AreEqual(LowercaseLetter.ToString(), UnicodeCategory(Categories.LowercaseLetter).ToString()); Assert.AreEqual(TitlecaseLetter.ToString(), UnicodeCategory(Categories.TitlecaseLetter).ToString()); Assert.AreEqual(ModifierLetter.ToString(), UnicodeCategory(Categories.ModifierLetter).ToString()); Assert.AreEqual(OtherLetter.ToString(), UnicodeCategory(Categories.OtherLetter).ToString()); Assert.AreEqual(Letter.ToString(), UnicodeCategory(Categories.Letter).ToString()); Assert.AreEqual(NonspacingMark.ToString(), UnicodeCategory(Categories.NonspacingMark).ToString()); Assert.AreEqual(SpacingCombiningMark.ToString(), UnicodeCategory(Categories.SpacingCombiningMark).ToString()); Assert.AreEqual(EnclosingMark.ToString(), UnicodeCategory(Categories.EnclosingMark).ToString()); Assert.AreEqual(Mark.ToString(), UnicodeCategory(Categories.Mark).ToString()); Assert.AreEqual(DecimalDigitNumber.ToString(), UnicodeCategory(Categories.DecimalDigitNumber).ToString()); Assert.AreEqual(LetterNumber.ToString(), UnicodeCategory(Categories.LetterNumber).ToString()); Assert.AreEqual(OtherNumber.ToString(), UnicodeCategory(Categories.OtherNumber).ToString()); Assert.AreEqual(Number.ToString(), UnicodeCategory(Categories.Number).ToString()); Assert.AreEqual(ConnectorPunctuation.ToString(), UnicodeCategory(Categories.ConnectorPunctuation).ToString()); Assert.AreEqual(DashPunctuation.ToString(), UnicodeCategory(Categories.DashPunctuation).ToString()); Assert.AreEqual(OpenPunctuation.ToString(), UnicodeCategory(Categories.OpenPunctuation).ToString()); Assert.AreEqual(ClosePunctuation.ToString(), UnicodeCategory(Categories.ClosePunctuation).ToString()); Assert.AreEqual(InitialquotePunctuation.ToString(), UnicodeCategory(Categories.InitialquotePunctuation).ToString()); Assert.AreEqual(FinalquotePunctuation.ToString(), UnicodeCategory(Categories.FinalquotePunctuation).ToString()); Assert.AreEqual(OtherPunctuation.ToString(), UnicodeCategory(Categories.OtherPunctuation).ToString()); Assert.AreEqual(Punctuation.ToString(), UnicodeCategory(Categories.Punctuation).ToString()); Assert.AreEqual(MathSymbol.ToString(), UnicodeCategory(Categories.MathSymbol).ToString()); Assert.AreEqual(CurrencySymbol.ToString(), UnicodeCategory(Categories.CurrencySymbol).ToString()); Assert.AreEqual(ModifierSymbol.ToString(), UnicodeCategory(Categories.ModifierSymbol).ToString()); Assert.AreEqual(OtherSymbol.ToString(), UnicodeCategory(Categories.OtherSymbol).ToString()); Assert.AreEqual(Patterns.Unicode.Symbol.ToString(), UnicodeCategory(Categories.Symbol).ToString()); Assert.AreEqual(SpaceSeparator.ToString(), UnicodeCategory(Categories.SpaceSeparator).ToString()); Assert.AreEqual(LineSeparator.ToString(), UnicodeCategory(Categories.LineSeparator).ToString()); Assert.AreEqual(ParagraphSeparator.ToString(), UnicodeCategory(Categories.ParagraphSeparator).ToString()); Assert.AreEqual(Separator.ToString(), UnicodeCategory(Categories.Separator).ToString()); Assert.AreEqual(Format.ToString(), UnicodeCategory(Categories.Format).ToString()); Assert.AreEqual(Surrogate.ToString(), UnicodeCategory(Categories.Surrogate).ToString()); Assert.AreEqual(PrivateUse.ToString(), UnicodeCategory(Categories.PrivateUse).ToString()); Assert.AreEqual(NotAssigned.ToString(), UnicodeCategory(Categories.NotAssigned).ToString()); Assert.AreEqual(OtherControl.ToString(), UnicodeCategory(Categories.OtherControl).ToString()); Assert.AreEqual(Control.ToString(), UnicodeCategory(Categories.Control).ToString()); Assert.AreEqual(BasicLatin.ToString(), UnicodeCategory(Categories.BasicLatin).ToString()); Assert.AreEqual(Latin_1Supplement.ToString(), UnicodeCategory(Categories.Latin_1Supplement).ToString()); Assert.AreEqual(LatinExtended_A.ToString(), UnicodeCategory(Categories.LatinExtended_A).ToString()); Assert.AreEqual(LatinExtended_B.ToString(), UnicodeCategory(Categories.LatinExtended_B).ToString()); Assert.AreEqual(IPAExtensions.ToString(), UnicodeCategory(Categories.IPAExtensions).ToString()); Assert.AreEqual(SpacingModifierLetters.ToString(), UnicodeCategory(Categories.SpacingModifierLetters).ToString()); Assert.AreEqual(CombiningDiacriticalMarks.ToString(), UnicodeCategory(Categories.CombiningDiacriticalMarks).ToString()); Assert.AreEqual(Greek.ToString(), UnicodeCategory(Categories.Greek).ToString()); Assert.AreEqual(GreekandCoptic.ToString(), UnicodeCategory(Categories.GreekandCoptic).ToString()); Assert.AreEqual(Cyrillic.ToString(), UnicodeCategory(Categories.Cyrillic).ToString()); Assert.AreEqual(CyrillicSupplement.ToString(), UnicodeCategory(Categories.CyrillicSupplement).ToString()); Assert.AreEqual(Armenian.ToString(), UnicodeCategory(Categories.Armenian).ToString()); Assert.AreEqual(Hebrew.ToString(), UnicodeCategory(Categories.Hebrew).ToString()); Assert.AreEqual(Arabic.ToString(), UnicodeCategory(Categories.Arabic).ToString()); Assert.AreEqual(Syriac.ToString(), UnicodeCategory(Categories.Syriac).ToString()); Assert.AreEqual(Thaana.ToString(), UnicodeCategory(Categories.Thaana).ToString()); Assert.AreEqual(Devanagari.ToString(), UnicodeCategory(Categories.Devanagari).ToString()); Assert.AreEqual(Bengali.ToString(), UnicodeCategory(Categories.Bengali).ToString()); Assert.AreEqual(Gurmukhi.ToString(), UnicodeCategory(Categories.Gurmukhi).ToString()); Assert.AreEqual(Gujarati.ToString(), UnicodeCategory(Categories.Gujarati).ToString()); Assert.AreEqual(Oriya.ToString(), UnicodeCategory(Categories.Oriya).ToString()); Assert.AreEqual(Tamil.ToString(), UnicodeCategory(Categories.Tamil).ToString()); Assert.AreEqual(Telugu.ToString(), UnicodeCategory(Categories.Telugu).ToString()); Assert.AreEqual(Kannada.ToString(), UnicodeCategory(Categories.Kannada).ToString()); Assert.AreEqual(Malayalam.ToString(), UnicodeCategory(Categories.Malayalam).ToString()); Assert.AreEqual(Sinhala.ToString(), UnicodeCategory(Categories.Sinhala).ToString()); Assert.AreEqual(Thai.ToString(), UnicodeCategory(Categories.Thai).ToString()); Assert.AreEqual(Lao.ToString(), UnicodeCategory(Categories.Lao).ToString()); Assert.AreEqual(Tibetan.ToString(), UnicodeCategory(Categories.Tibetan).ToString()); Assert.AreEqual(Myanmar.ToString(), UnicodeCategory(Categories.Myanmar).ToString()); Assert.AreEqual(Georgian.ToString(), UnicodeCategory(Categories.Georgian).ToString()); Assert.AreEqual(HangulJamo.ToString(), UnicodeCategory(Categories.HangulJamo).ToString()); Assert.AreEqual(Ethiopic.ToString(), UnicodeCategory(Categories.Ethiopic).ToString()); Assert.AreEqual(Cherokee.ToString(), UnicodeCategory(Categories.Cherokee).ToString()); Assert.AreEqual(UnifiedCanadianAboriginalSyllabics.ToString(), UnicodeCategory(Categories.UnifiedCanadianAboriginalSyllabics).ToString()); Assert.AreEqual(Ogham.ToString(), UnicodeCategory(Categories.Ogham).ToString()); Assert.AreEqual(Runic.ToString(), UnicodeCategory(Categories.Runic).ToString()); Assert.AreEqual(Tagalog.ToString(), UnicodeCategory(Categories.Tagalog).ToString()); Assert.AreEqual(Hanunoo.ToString(), UnicodeCategory(Categories.Hanunoo).ToString()); Assert.AreEqual(Buhid.ToString(), UnicodeCategory(Categories.Buhid).ToString()); Assert.AreEqual(Tagbanwa.ToString(), UnicodeCategory(Categories.Tagbanwa).ToString()); Assert.AreEqual(Khmer.ToString(), UnicodeCategory(Categories.Khmer).ToString()); Assert.AreEqual(Mongolian.ToString(), UnicodeCategory(Categories.Mongolian).ToString()); Assert.AreEqual(Limbu.ToString(), UnicodeCategory(Categories.Limbu).ToString()); Assert.AreEqual(TaiLe.ToString(), UnicodeCategory(Categories.TaiLe).ToString()); Assert.AreEqual(KhmerSymbols.ToString(), UnicodeCategory(Categories.KhmerSymbols).ToString()); Assert.AreEqual(PhoneticExtensions.ToString(), UnicodeCategory(Categories.PhoneticExtensions).ToString()); Assert.AreEqual(LatinExtendedAdditional.ToString(), UnicodeCategory(Categories.LatinExtendedAdditional).ToString()); Assert.AreEqual(GreekExtended.ToString(), UnicodeCategory(Categories.GreekExtended).ToString()); Assert.AreEqual(GeneralPunctuation.ToString(), UnicodeCategory(Categories.GeneralPunctuation).ToString()); Assert.AreEqual(SuperscriptsandSubscripts.ToString(), UnicodeCategory(Categories.SuperscriptsandSubscripts).ToString()); Assert.AreEqual(CurrencySymbols.ToString(), UnicodeCategory(Categories.CurrencySymbols).ToString()); Assert.AreEqual(CombiningDiacriticalMarksforSymbols.ToString(), UnicodeCategory(Categories.CombiningDiacriticalMarksforSymbols).ToString()); Assert.AreEqual(CombiningMarksforSymbols.ToString(), UnicodeCategory(Categories.CombiningMarksforSymbols).ToString()); Assert.AreEqual(LetterlikeSymbols.ToString(), UnicodeCategory(Categories.LetterlikeSymbols).ToString()); Assert.AreEqual(NumberForms.ToString(), UnicodeCategory(Categories.NumberForms).ToString()); Assert.AreEqual(Arrows.ToString(), UnicodeCategory(Categories.Arrows).ToString()); Assert.AreEqual(MathematicalOperators.ToString(), UnicodeCategory(Categories.MathematicalOperators).ToString()); Assert.AreEqual(MiscellaneousTechnical.ToString(), UnicodeCategory(Categories.MiscellaneousTechnical).ToString()); Assert.AreEqual(ControlPictures.ToString(), UnicodeCategory(Categories.ControlPictures).ToString()); Assert.AreEqual(OpticalCharacterRecognition.ToString(), UnicodeCategory(Categories.OpticalCharacterRecognition).ToString()); Assert.AreEqual(EnclosedAlphanumerics.ToString(), UnicodeCategory(Categories.EnclosedAlphanumerics).ToString()); Assert.AreEqual(BoxDrawing.ToString(), UnicodeCategory(Categories.BoxDrawing).ToString()); Assert.AreEqual(BlockElements.ToString(), UnicodeCategory(Categories.BlockElements).ToString()); Assert.AreEqual(GeometricShapes.ToString(), UnicodeCategory(Categories.GeometricShapes).ToString()); Assert.AreEqual(MiscellaneousSymbols.ToString(), UnicodeCategory(Categories.MiscellaneousSymbols).ToString()); Assert.AreEqual(Dingbats.ToString(), UnicodeCategory(Categories.Dingbats).ToString()); Assert.AreEqual(MiscellaneousMathematicalSymbols_A.ToString(), UnicodeCategory(Categories.MiscellaneousMathematicalSymbols_A).ToString()); Assert.AreEqual(SupplementalArrows_A.ToString(), UnicodeCategory(Categories.SupplementalArrows_A).ToString()); Assert.AreEqual(BraillePatterns.ToString(), UnicodeCategory(Categories.BraillePatterns).ToString()); Assert.AreEqual(SupplementalArrows_B.ToString(), UnicodeCategory(Categories.SupplementalArrows_B).ToString()); Assert.AreEqual(MiscellaneousMathematicalSymbols_B.ToString(), UnicodeCategory(Categories.MiscellaneousMathematicalSymbols_B).ToString()); Assert.AreEqual(SupplementalMathematicalOperators.ToString(), UnicodeCategory(Categories.SupplementalMathematicalOperators).ToString()); Assert.AreEqual(MiscellaneousSymbolsandArrows.ToString(), UnicodeCategory(Categories.MiscellaneousSymbolsandArrows).ToString()); Assert.AreEqual(CJKRadicalsSupplement.ToString(), UnicodeCategory(Categories.CJKRadicalsSupplement).ToString()); Assert.AreEqual(KangxiRadicals.ToString(), UnicodeCategory(Categories.KangxiRadicals).ToString()); Assert.AreEqual(IdeographicDescriptionCharacters.ToString(), UnicodeCategory(Categories.IdeographicDescriptionCharacters).ToString()); Assert.AreEqual(CJKSymbolsandPunctuation.ToString(), UnicodeCategory(Categories.CJKSymbolsandPunctuation).ToString()); Assert.AreEqual(Hiragana.ToString(), UnicodeCategory(Categories.Hiragana).ToString()); Assert.AreEqual(Katakana.ToString(), UnicodeCategory(Categories.Katakana).ToString()); Assert.AreEqual(Bopomofo.ToString(), UnicodeCategory(Categories.Bopomofo).ToString()); Assert.AreEqual(HangulCompatibilityJamo.ToString(), UnicodeCategory(Categories.HangulCompatibilityJamo).ToString()); Assert.AreEqual(Kanbun.ToString(), UnicodeCategory(Categories.Kanbun).ToString()); Assert.AreEqual(BopomofoExtended.ToString(), UnicodeCategory(Categories.BopomofoExtended).ToString()); Assert.AreEqual(KatakanaPhoneticExtensions.ToString(), UnicodeCategory(Categories.KatakanaPhoneticExtensions).ToString()); Assert.AreEqual(EnclosedCJKLettersandMonths.ToString(), UnicodeCategory(Categories.EnclosedCJKLettersandMonths).ToString()); Assert.AreEqual(CJKCompatibility.ToString(), UnicodeCategory(Categories.CJKCompatibility).ToString()); Assert.AreEqual(CJKUnifiedIdeographsExtensionA.ToString(), UnicodeCategory(Categories.CJKUnifiedIdeographsExtensionA).ToString()); Assert.AreEqual(YijingHexagramSymbols.ToString(), UnicodeCategory(Categories.YijingHexagramSymbols).ToString()); Assert.AreEqual(CJKUnifiedIdeographs.ToString(), UnicodeCategory(Categories.CJKUnifiedIdeographs).ToString()); Assert.AreEqual(YiSyllables.ToString(), UnicodeCategory(Categories.YiSyllables).ToString()); Assert.AreEqual(YiRadicals.ToString(), UnicodeCategory(Categories.YiRadicals).ToString()); Assert.AreEqual(HangulSyllables.ToString(), UnicodeCategory(Categories.HangulSyllables).ToString()); Assert.AreEqual(HighSurrogates.ToString(), UnicodeCategory(Categories.HighSurrogates).ToString()); Assert.AreEqual(HighPrivateUseSurrogates.ToString(), UnicodeCategory(Categories.HighPrivateUseSurrogates).ToString()); Assert.AreEqual(LowSurrogates.ToString(), UnicodeCategory(Categories.LowSurrogates).ToString()); Assert.AreEqual(PrivateUseArea.ToString(), UnicodeCategory(Categories.PrivateUseArea).ToString()); Assert.AreEqual(CJKCompatibilityIdeographs.ToString(), UnicodeCategory(Categories.CJKCompatibilityIdeographs).ToString()); Assert.AreEqual(LettericPresentationForms.ToString(), UnicodeCategory(Categories.LettericPresentationForms).ToString()); Assert.AreEqual(ArabicPresentationForms_A.ToString(), UnicodeCategory(Categories.ArabicPresentationForms_A).ToString()); Assert.AreEqual(VariationSelectors.ToString(), UnicodeCategory(Categories.VariationSelectors).ToString()); Assert.AreEqual(CombiningHalfMarks.ToString(), UnicodeCategory(Categories.CombiningHalfMarks).ToString()); Assert.AreEqual(CJKCompatibilityForms.ToString(), UnicodeCategory(Categories.CJKCompatibilityForms).ToString()); Assert.AreEqual(SmallFormVariants.ToString(), UnicodeCategory(Categories.SmallFormVariants).ToString()); Assert.AreEqual(ArabicPresentationForms_B.ToString(), UnicodeCategory(Categories.ArabicPresentationForms_B).ToString()); Assert.AreEqual(HalfwidthandFullwidthForms.ToString(), UnicodeCategory(Categories.HalfwidthandFullwidthForms).ToString()); Assert.AreEqual(Specials.ToString(), UnicodeCategory(Categories.Specials).ToString()); }
static string Switch(Greek value) => value switch {
private static bool TryParseBySwitch(string value, bool ignoreCase, out Greek e) { if (ignoreCase) { if (value.Equals(nameof(Greek.Alpha), StringComparison.OrdinalIgnoreCase)) { e = Greek.Alpha; return(true); } if (value.Equals(nameof(Greek.Beta), StringComparison.OrdinalIgnoreCase)) { e = Greek.Beta; return(true); } if (value.Equals(nameof(Greek.Cappa), StringComparison.OrdinalIgnoreCase)) { e = Greek.Cappa; return(true); } if (value.Equals(nameof(Greek.Delta), StringComparison.OrdinalIgnoreCase)) { e = Greek.Delta; return(true); } if (value.Equals(nameof(Greek.Epsilon), StringComparison.OrdinalIgnoreCase)) { e = Greek.Epsilon; return(true); } if (value.Equals(nameof(Greek.Gamma), StringComparison.OrdinalIgnoreCase)) { e = Greek.Gamma; return(true); } if (value.Equals(nameof(Greek.Omega), StringComparison.OrdinalIgnoreCase)) { e = Greek.Omega; return(true); } if (value.Equals(nameof(Greek.Phi), StringComparison.OrdinalIgnoreCase)) { e = Greek.Phi; return(true); } if (value.Equals(nameof(Greek.Theta), StringComparison.OrdinalIgnoreCase)) { e = Greek.Theta; return(true); } if (value.Equals(nameof(Greek.None), StringComparison.OrdinalIgnoreCase)) { e = Greek.None; return(true); } e = default !;
public static void GetName(Greek expected) { var s = expected.ToString(); Assert.Equal(s, expected.GetName()); }