Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- [Flags]
- public enum TraumaDamages
- {
- NONE = 0,
- SLASH = 1 << 1,
- PIERCE = 1 << 2,
- BURN = 1 << 3
- }
- public static void Main()
- {
- var onlyBurn = TraumaDamages.BURN;
- var onlySlash = TraumaDamages.SLASH;
- var onlyPierce = TraumaDamages.PIERCE;
- var testGroup1 = new TraumaDamages[]{onlyBurn, onlySlash, onlyPierce};
- Test(testGroup1);
- Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
- var burnSlash = TraumaDamages.BURN | TraumaDamages.SLASH;
- var burnPierce = TraumaDamages.BURN | TraumaDamages.PIERCE;
- var slashPierce = TraumaDamages.SLASH | TraumaDamages.PIERCE;
- var all = TraumaDamages.SLASH | TraumaDamages.PIERCE | TraumaDamages.BURN;
- var testGroup2 = new TraumaDamages[]{burnSlash, burnPierce, slashPierce, all};
- Test(testGroup2);
- }
- public static void Test(TraumaDamages[] group)
- {
- var c = 0;
- foreach (var testCase in group)
- {
- c++;
- PerformTest(testCase, c);
- }
- }
- public static void PerformTest(TraumaDamages testee, int index)
- {
- Console.WriteLine("*******************************");
- if (testee.HasFlag(TraumaDamages.BURN))
- {
- Console.WriteLine("Testing case: " + index.ToString() + ". Entered block: BURN");
- }
- if (testee.HasFlag(TraumaDamages.SLASH))
- {
- Console.WriteLine("Testing case: " + index.ToString() + ". Entered block: SLASH");
- }
- if (testee.HasFlag(TraumaDamages.PIERCE))
- {
- Console.WriteLine("Testing case: " + index.ToString() + ". Entered block: PIERCE");
- }
- }
- }
Add Comment
Please, Sign In to add comment