コード例 #1
0
        static void Main(string[] args)
        {
            Program program = new Program();
            Thread  thread  = new Thread(new ParameterizedThreadStart(program.Method));

            ITracer tracer = new Tracer.Tracer();
            Foo     foo    = new Foo(tracer);

            foo.MyMethod();
            foo.MyMethod2();
            thread.Start(tracer);
            thread.Join();

            XmlSerializer        xmlTracerSerializer  = new XmlSerializer();
            JsonTracerSerializer jsonTracerSerializer = new JsonTracerSerializer();
            TraceResult          traceResult          = tracer.GetTraceResult();
            string xml  = xmlTracerSerializer.Serialize(traceResult);
            string json = jsonTracerSerializer.Serialize(traceResult);

            FileSaver fs = new FileSaver("trace.json");

            fs.Print(xml);
            fs.Print(json);

            ConsolePrinter cp = new ConsolePrinter();

            cp.Print(xml);
            cp.Print(json);

            Console.ReadKey();
        }
コード例 #2
0
    public static void Main()
    {
        ConsolePrinter printer = new ConsolePrinter();

        printer.Print(true);
        printer.Print(false);
    }
コード例 #3
0
ファイル: Program.cs プロジェクト: igor-zhylin/HashTableApp
        static void Main(string[] args)
        {
            var hashTable = new HashTable();

            hashTable.Insert("Captain", "Anyone who reads Old and Middle English literary texts will be familiar with the mid-brown volumes of the EETS,");
            hashTable.Insert("Radio staff", "As its name states, EETS was begun as a 'club', and it retains certain features of that even now...");
            hashTable.Insert("Medical staff", "Many comparable societies, with different areas of interest, were founded in the nineteenth century (several of them also by Furnivall);");
            hashTable.Insert("Junior mate (fourth mate)", "We hope you will maintain your membership, and will encourage both the libraries you use and also other individuals to join");

            //Write all table
            IPrinter printer = new ConsolePrinter();

            printer.Print(hashTable, "All in Collection");
            Console.WriteLine();

            hashTable.Delete("Radio staff");
            printer.Print(hashTable, "Delete item test");
            Console.WriteLine();

            var searchTestItem = hashTable.Search("Junior mate (fourth mate)");

            printer.Print(searchTestItem, "SearchTest");

            Console.ReadKey();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: drazen-b/OOP_Zadaca_CS
        static void DZ3()
        {
            // Assume that the number of rows in the text file is always at least 10.
            // Assume a valid input file.
            string fileName       = "shows.tv";
            string outputFileName = "storage.tv";

            IPrinter printer = new ConsolePrinter();

            printer.Print($"Reading data from file {fileName}");

            Episode[] episodes = TvUtilities.LoadEpisodesFromFile(fileName);

            Season season = new Season(1, episodes);


            printer.Print(season.ToString());
            for (int i = 0; i < season.Length; i++)
            {
                season[i].AddView(TvUtilities.GenerateRandomScore());
            }
            printer.Print(season.ToString());

            printer = new FilePrinter(outputFileName);
            printer.Print(season.ToString());
        }
コード例 #5
0
        private void PrintAllNotesNames(NoteNodeResource noteNodeResource)
        {
            IEnumerable <string> notesToPrint = noteNodeResource.Children.Keys
                                                .Where(noteName => Path.GetExtension(noteName).Equals(TaskerConsts.NoteExtension))
                                                .Select(noteName => Path.GetFileNameWithoutExtension(noteName));

            mConsolePrinter.Print(notesToPrint, header: "NOTES");
        }
コード例 #6
0
        static void Main(string[] args)
        {
            var statisticCalculator   = new StatisticCalculator(TextFileName);
            IStatisticPrinter printer = new ConsolePrinter();

            Statistic statistic = statisticCalculator.CalculateUsingSingleThread();

            printer.Print(statistic);

            statistic = statisticCalculator.CalculateUsingAllThreads();
            printer.Print(statistic);
        }
コード例 #7
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void Game_OnIssueOrder(Obj_AI_Base hero, Obj_AI_BaseIssueOrderEventArgs args)
        {
            if (!hero.IsMe)
            {
                return;
            }

            if (TestMenu["(TestPath)"].Enabled)
            {
                var tPath = MyHero.GetPath(args.Target.Position);

                foreach (var point in tPath)
                {
                    var point2D = point.To2D();
                    RenderObjects.Add(new RenderCircle(point2D, 500));
                }
            }

            if (args.OrderType != OrderType.MoveTo)
            {
                return;
            }

            if (TestMenu["(EvadeTesterPing)"].Enabled)
            {
                ConsolePrinter.Print("Sending Path ClickTime: " + (Environment.TickCount - _lastRightMouseClickTime));
            }

            var heroPos = ObjectCache.MyHeroCache.ServerPos2D;
            var pos     = args.Target.Position.To2D();
            var speed   = ObjectCache.MyHeroCache.MoveSpeed;

            _startWalkTime = Environment.TickCount;

            foreach (var entry in SpellDetector.Spells)
            {
                var spell   = entry.Value;
                var walkDir = (pos - heroPos).Normalized();

                var spellTime = Environment.TickCount - spell.StartTime - spell.Info.SpellDelay;
                var spellPos  = spell.StartPos + spell.Direction * spell.Info.ProjectileSpeed * (spellTime / 1000);
                //ConsolePrinter.Print("aaaa" + spellTime);

                var movingCollisionTime = MathUtils.GetCollisionTime(heroPos,
                                                                     spellPos,
                                                                     walkDir * (speed - 25),
                                                                     spell.Direction * (spell.Info.ProjectileSpeed - 200),
                                                                     ObjectCache.MyHeroCache.BoundingRadius,
                                                                     spell.Radius,
                                                                     out var isCollision);
                if (!isCollision)
                {
                    continue;
                }
                if (true)
                {
                    ConsolePrinter.Print("movingCollisionTime: " + movingCollisionTime);
                }
            }
        }
コード例 #8
0
ファイル: ConsolePrinterTest.cs プロジェクト: SWTGruppe29/ATM
        public void NoTracksInList()
        {
            List <Track>   uutTracks = new List <Track>();
            ConsolePrinter uut       = new ConsolePrinter();

            uut.Print(uutTracks, null);
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var input  = new int[] { 1, 2, 3, 4, 5 };
            var result = SearchMaxMin.FindMax(input);

            ConsolePrinter.Print(result);
        }
コード例 #10
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void CompareSpellLocation(Spell spell, Vector2 pos, float time)
        {
            var pos2 = spell.CurrentSpellPosition;

            if (spell.SpellObject != null)
            {
                ConsolePrinter.Print("Compare: " + pos2.Distance(pos) / (Environment.TickCount - time));
            }
        }
コード例 #11
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void Game_OnDoCast(Obj_AI_Base sender, Obj_AI_BaseMissileClientDataEventArgs args)
        {
            if (!TestMenu["(ShowDoCastInfo)"].Enabled)
            {
                return;
            }

            ConsolePrinter.Print("DoCast " + sender.Name + ": " + args.SpellData.Name);
        }
コード例 #12
0
        public void Create_CurriculumVitae_Minimum_Information_Successfully()
        {
            // Create Curriculum Vitae using CurriculumVitae builder
            CurriculumVitae curriculum = CVBuilder.Core.CurriculumVitaeBuilder
                                         .Start()
                                         .WithFirstName("Daniel")
                                         .WithLastName("Bran")
                                         .WithPhoneNumber("0040734***375")
                                         .WithEmail("bran******@gmail.com")
                                         .WithAddress()
                                         .WithCountry("Romania")
                                         .WithCounty("Bihor")
                                         .WithCity("Oradea")
                                         .Update()
                                         .WithLanguage("English")
                                         .WithLanguage("Spanish")
                                         .WithLanguage("Romanian")
                                         .WithNationaity("Romanian")
                                         .WithEducationItem(
                new Education()
            {
                Id          = 1,
                Title       = "Coumputer Science Faculty",
                Description = "Coumputer Science Faculty at University of Oradea"
            })
                                         .WithEducationItem(
                new Education()
            {
                Id          = 2,
                Title       = "Master of Computer Science",
                Description = "Master of Computer Science at University of Oradea, theme Distributed systems in internet"
            })
                                         .WithBirthday(DateTime.Now.AddYears(-18))
                                         .AddPhoto("https://media-exp1.licdn.com/dms/image/C5103AQGKJtoudXZHSg/profile-displayphoto-shrink_200_200/0?e=1584576000&v=beta&t=B1EuznIzsSR6CEJVoSzXEzIAJudSsIpC8Ky8_EGqBnw")
                                         .Finish();

            // Create new console printer to display the curriculum into Test output.
            ConsolePrinter consolePrinter = new ConsolePrinter();

            // Print CV into Test output.
            consolePrinter.Print(curriculum);

            // Test asserts
            Assert.AreEqual(curriculum.FullName, "Daniel Bran");
            Assert.AreEqual(curriculum.PhoneNumber, "0040734***375");
            Assert.AreEqual(curriculum.EmailAddress, "bran******@gmail.com");
            Assert.AreEqual(curriculum.Address.Country, "Romania");
            Assert.AreEqual(curriculum.Address.County, "Bihor");
            Assert.AreEqual(curriculum.Address.City, "Oradea");
            Assert.IsTrue(curriculum.Languages.Count == 3);
            Assert.AreEqual(curriculum.Nationality, "Romanian");
            Assert.IsTrue(curriculum.Educations.ToList().Count == 2);
            Assert.Pass();
        }
コード例 #13
0
ファイル: LevelMatrix.cs プロジェクト: IAJ-g04/Project4
        public void PrintMatrix()
        {
            for (int i = 0; i < Matrix_Height; i++)
            {
                for (int j = 0; j < Matrix_Width; j++)
                {
                    ConsolePrinter.Print(this.Matrix[j, i] + "\t");
                }

                ConsolePrinter.Print("\r\n");
            }
        }
コード例 #14
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void CompareSpellLocation2(Spell spell)
        {
            var pos1    = spell.CurrentSpellPosition;
            var timeNow = Environment.TickCount;

            if (spell.SpellObject != null)
            {
                ConsolePrinter.Print("start distance: " + spell.StartPos.Distance(pos1));
            }

            DelayAction.Add(250, () => CompareSpellLocation(spell, pos1, timeNow));
        }
コード例 #15
0
ファイル: Player.cs プロジェクト: Agalc/Console-BlackJack
 public override void DecideWhetherTakeCard(Deck deck)
 {
     do
     {
         if (Result == PlayerResult.BlackJack)
         {
             _printer.Print($"You have a blackjack");
         }
         _printer.Print("Do You want to draw another one? y/n");
         string ch = _printer.ReadLine();
         if (ch[0] == 'y')
         {
             PutCardInHand(deck.DrawCard());
             _printer.Print(ToString());
         }
         else
         {
             break;
         }
     } while (Score < 21);
 }
コード例 #16
0
ファイル: Task3.cs プロジェクト: YuraPas/.Net-Lab
        public void Run()
        {
            ConsolePrinter consoleSubstitutor = new ConsolePrinter();
            int            userInput          = consoleSubstitutor.Read();

            while (userInput > 4 || userInput < 0)
            {
                userInput = Convert.ToInt32(consoleSubstitutor.Read());
            }
            //todo : put the process of user input into another method
            consoleSubstitutor.Print(OuputYearPeriod(userInput));
        }
コード例 #17
0
        static void Main(string[] args)
        {
            string fileName       = "shows.tv";
            string outputFileName = "storage.tv";

            IPrinter printer = new ConsolePrinter();

            printer.Print($"Reading data from file {fileName}");

            Episode[] episodes = TvUtilities.LoadEpisodesFromFile(fileName);
            Season    season   = new Season(1, episodes);

            printer.Print(season.ToString());
            for (int i = 0; i < season.Length; i++)
            {
                season[i].AddView(TvUtilities.GenerateRandomScore());
            }
            printer.Print(season.ToString());

            printer = new FilePrinter(outputFileName);
            printer.Print(season.ToString());
        }
コード例 #18
0
        static void Main(string[] args)
        {
            FackerProgram.Faker faker = new FackerProgram.Faker();
            MyTestClass         test;
            ConsolePrinter      printer;

            test = faker.Create <MyTestClass>();
            Console.WriteLine();
            printer = new ConsolePrinter();
            printer.DTOListAdd(typeof(Foo));
            printer.DTOListAdd(typeof(Bar));
            printer.Print(test, "");
        }
コード例 #19
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void Game_OnDamage(AttackableUnit sender, AttackableUnitDamageEventArgs args)
        {
            if (!TestMenu["(TestSpellEndTime)"].Enabled)
            {
                return;
            }

            if (!sender.IsMe)
            {
                return;
            }

            ConsolePrinter.Print("Damage taken time: " + (Environment.TickCount - _lastSpellCastTime));
        }
コード例 #20
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private static void ObjAiHeroOnOnNewPath(Obj_AI_Base unit, Obj_AI_BaseNewPathEventArgs args)
        {
            if (unit.Type != GameObjectType.obj_AI_Hero)
            {
                return;
            }

            if (!args.IsDash || !TestMenu["(ShowDashInfo)"].Enabled)
            {
                return;
            }
            var dist = args.Path.First().Distance(args.Path.Last());

            ConsolePrinter.Print("Dash Speed: " + args.Speed + " Dash dist: " + dist);
        }
コード例 #21
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void Game_OnDelete(GameObject sender)
        {
            if (!TestMenu["(ShowMissileInfo)"].Enabled)
            {
                return;
            }

            if (_testMissile == null || _testMissile.NetworkId != sender.NetworkId)
            {
                return;
            }

            var range = sender.Position.To2D().Distance(_testMissile.StartPosition.To2D());

            ConsolePrinter.Print("[" + _testMissile.SpellData.Name + "]: Est.Missile range: " + range);
            ConsolePrinter.Print("[" + _testMissile.SpellData.Name + "]: Est.Missile speed: " + 1000 * (range / (Environment.TickCount - _testMissileStartTime)));
        }
コード例 #22
0
ファイル: ConsolePrinterTest.cs プロジェクト: SWTGruppe29/ATM
        public void TwoTracksInAirspaceNoCompCourse()
        {
            DateTime time1 = new DateTime(2018, 03, 12, 14, 50, 25, 543);
            DateTime time2 = new DateTime(2016, 03, 12, 15, 50, 25, 543);

            List <Track> uutTracks = new List <Track>()
            {
                new Track("5412BJ", 12345, 15312, 84393, time1),
                new Track("5417KJ", 15445, 15342, 84393, time1)
            };

            List <Conflict> uutConflicts = new List <Conflict>();

            ConsolePrinter uut = new ConsolePrinter();

            uut.Print(uutTracks, uutConflicts);
        }
コード例 #23
0
        public void ConsolePrinterClearScreen_WhenSomethingIsPrinted_ShouldClearIt()
        {
            // arrange
            var printer = new ConsolePrinter();
            printer.PrintLine();
            printer.PrintLine("Test line");
            printer.PrintLine();
            printer.Print("Test");

            // act
            printer.ClearScreen();

            // assert
            var actual = this.stringWriter.ToString();
            var expected = string.Empty;

            Assert.AreEqual(expected, actual);
        }
コード例 #24
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void Game_ProcessSpell(Obj_AI_Base hero, Obj_AI_BaseMissileClientDataEventArgs args)
        {
            if (!(hero is Obj_AI_Hero))
            {
                return;
            }

            if (TestMenu["(ShowProcessSpell)"].Enabled)
            {
                ConsolePrinter.Print(args.SpellData.Name + " CastTime: " + (hero.SpellBook.CastEndTime - Game.ClockTime));

                ConsolePrinter.Print("CastRadius: " + args.SpellData.CastRadius);
            }

            if (args.SpellData.Name == "YasuoQW")
            {
                RenderObjects.Add(new RenderCircle(args.Start.To2D(), 500));
                RenderObjects.Add(new RenderCircle(args.End.To2D(), 500));
            }

            _lastHeroSpellCastTime = Environment.TickCount;

            foreach (var entry in SpellDetector.Spells)
            {
                var spell = entry.Value;

                if (spell.Info.SpellName != args.SpellData.Name || spell.HeroId != hero.NetworkId)
                {
                    continue;
                }

                if (spell.Info.IsThreeWay == false && spell.Info.IsSpecial == false)
                {
                    ConsolePrinter.Print("Time diff: " + (Environment.TickCount - spell.StartTime));
                }
            }

            if (hero.IsMe)
            {
                _lastSpellCastTime = Environment.TickCount;
            }
        }
コード例 #25
0
ファイル: ConsolePrinterTest.cs プロジェクト: SWTGruppe29/ATM
        public void TwoTracksInConflictAndAirspace()
        {
            DateTime time1 = new DateTime(2018, 03, 12, 14, 50, 25, 543);
            DateTime time2 = new DateTime(2016, 03, 12, 15, 50, 25, 543);

            List <Track> uutTracks = new List <Track>()
            {
                new Track("5412BJ", 12345, 15312, 84393, time1, 154.5433, 1000),
                new Track("5417KJ", 15445, 15342, 84393, time1, 154.233, 987.123)
            };

            List <Conflict> conflicts = new List <Conflict>()
            {
                new Conflict("blabla123", "123blabla")
            };

            ConsolePrinter uut = new ConsolePrinter();

            uut.Print(uutTracks, conflicts);
        }
コード例 #26
0
        public static void Sample1()
        {
            //Declare an array, initialize, and get type.
            int[] numbers;
            numbers = new int[] { 0, 1, 2, 3, 4 };
            Type arrayType = numbers.GetType();

            if (arrayType.IsArray)
            {
                Console.WriteLine("The array type is: {0}", arrayType);
            }
            else
            {
                Console.WriteLine("Not an array");
            }

            //Declare a two dimensional array and initialize.
            int[,] grades = new int[, ] {
                { 1, 82, 74, 89, 100 },
                { 2, 93, 96, 85, 86 },
                { 3, 83, 72, 95, 89 },
                { 4, 91, 98, 79, 88 }
            };
            int    last_grade = grades.GetUpperBound(1);
            double average    = 0.0;
            int    total;
            int    last_student = grades.GetUpperBound(0);

            for (int row = 0; row <= last_student; row++)
            {
                total = 0;
                for (int col = 0; col <= last_grade; col++)
                {
                    total  += grades[row, col];
                    average = total / last_grade;
                    Console.WriteLine("Average: " + average);
                }
            }

            ConsolePrinter.Print(sumNums(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
        }
コード例 #27
0
        public void GetGridHint_WhenMineInLeftColumn_ProducesExpectedGridHint()
        {
            m_TestInput = new Cell[3, 3]
            {
                { Cell.Mine, Cell.NoMine, Cell.NoMine },
                { Cell.NoMine, Cell.NoMine, Cell.NoMine },
                { Cell.NoMine, Cell.NoMine, Cell.NoMine }
            };
            m_TestGame = new GameWithCell(m_TestInput);
            var expectedGridHint = new string[3, 3]
            {
                { "*", "1", "0" },
                { "1", "1", "0" },
                { "0", "0", "0" }
            };

            var resultingGridHint = m_TestGame.ProvideGridHint();

            ConsolePrinter.Print(resultingGridHint);
            Assert.That(resultingGridHint, Is.EqualTo(expectedGridHint));
        }
コード例 #28
0
ファイル: Program.cs プロジェクト: 0xack13/Shiny.Calculator
        private static EvaluatorState Evaluate(string statement, string prompt)
        {
            Console.WriteLine();

            if (string.IsNullOrWhiteSpace(statement))
            {
                return(null);
            }

            VariableResolver resolver = new VariableResolver();

            var tokens = tokenizer.Tokenize(statement);
            var ast    = parser.Parse(tokens);

            var variables = resolver.Resolve(ast);

            foreach (var resolved in variables)
            {
                var nestedPrompt = $"{resolved.Key} = ";

                var stmt  = ProcessKeyEvents(nestedPrompt);
                var value = Evaluate(stmt, nestedPrompt);

                printer.Print(new Run()
                {
                    Text = "  --------", Color = RunColor.White
                });

                var existing = variables[resolved.Key];

                existing.IsSigned = value.IsSigned;
                existing.Type     = value.Type;
                existing.Value    = value.Value;
            }

            var result = evaluator.Evaluate(ast, variables, printer, context);

            return(result);
        }
コード例 #29
0
        public async Task ShouldPrintExpectedOutput(ConsolePrinterTestModel testData)
        {
            var mockFeedParser        = new Mock <IFeedDataParser>();
            var mockFeedParserFactory = new Mock <IFeedParserFactory>();
            var fakeConsoleWrapper    = new FakeConsoleWrapper();

            mockFeedParser
            .Setup(m => m.Parse(It.IsAny <string>()))
            .Returns(Task.FromResult(testData.StubFixtures));

            mockFeedParserFactory
            .Setup(m => m.Create(It.IsAny <FeedSource>()))
            .Returns(mockFeedParser.Object);

            var sut = new ConsolePrinter(fakeConsoleWrapper, mockFeedParserFactory.Object);

            await sut.Print(FeedSource.Caulfield, string.Empty);

            Assert.IsTrue(
                testData.ExpectedOutput.SequenceEqual(fakeConsoleWrapper.Outputs),
                testData.TestCaseName);
        }
コード例 #30
0
        public void GetGridHint_WhenMultipleMinesArePlotted_ProducesExpectedGridHint()
        {
            m_TestInput = new Cell[3, 4]
            {
                { Cell.Mine, Cell.NoMine, Cell.NoMine, Cell.NoMine },
                { Cell.NoMine, Cell.NoMine, Cell.Mine, Cell.NoMine },
                { Cell.NoMine, Cell.NoMine, Cell.NoMine, Cell.NoMine }
            };
            // string [] input = new string[] {"*...","..*.","...."};
            //m_TestInput = StringToArrayOfCell(input);
            m_TestGame = new GameWithCell(m_TestInput);
            var expectedGridHint = new string[3, 4]
            {
                { "*", "2", "1", "1" },
                { "1", "2", "*", "1" },
                { "0", "1", "1", "1" }
            };

            var resultingGridHint = m_TestGame.ProvideGridHint();

            ConsolePrinter.Print(resultingGridHint);
            Assert.That(resultingGridHint, Is.EqualTo(expectedGridHint));
        }
コード例 #31
0
ファイル: EvadeTester.cs プロジェクト: yegithub/Aimtec-2
        private void Game_OnGameUpdate()
        {
            if (_startWalkTime > 0)
            {
                if (Environment.TickCount - _startWalkTime > 500 && MyHero.HasPath == false)
                {
                    _startWalkTime = 0;
                }
            }

            if (TestMenu["(ShowWindupTime)"].Enabled)
            {
                if (MyHero.HasPath && _lastStopingTime > 0)
                {
                    ConsolePrinter.Print("WindupTime: " + (Environment.TickCount - _lastStopingTime));
                    _lastStopingTime = 0;
                }
                else if (!MyHero.HasPath && _lastStopingTime == 0)
                {
                    _lastStopingTime = Environment.TickCount;
                }
            }

            if (!TestMenu["(ShowDashInfo)"].Enabled)
            {
                return;
            }

            if (!MyHero.IsDashing())
            {
                return;
            }

            var dashInfo = MyHero.GetDashInfo();

            ConsolePrinter.Print("Dash Speed: " + dashInfo.Speed + " Dash dist: " + dashInfo.EndPos.Distance(dashInfo.StartPos));
        }
コード例 #32
0
        public static void Sample2()
        {
            int[]   Jan = new int[31];
            int[]   Feb = new int[29];
            int[][] sales = new int[][] { Jan, Feb }; //There is a type on the sample code
            int     month, day, total2;
            double  average2 = 0.0;

            sales[0][0] = 41;
            sales[0][1] = 30;
            sales[0][0] = 41;
            sales[0][1] = 30;
            sales[0][2] = 23;
            sales[0][3] = 34;
            sales[0][4] = 28;
            sales[0][5] = 35;
            sales[0][6] = 45;
            sales[1][0] = 35;
            sales[1][1] = 37;
            sales[1][2] = 32;
            sales[1][3] = 26;
            sales[1][4] = 45;
            sales[1][5] = 38;
            sales[1][6] = 42;
            for (month = 0; month <= 1; month++)
            {
                total2 = 0;
                for (day = 0; day <= 6; day++)
                {
                    total2 += sales[month][day];
                }
                average2 = total2 / 7;
                Console.WriteLine("Average sales for month: " + month + ": " + average2);
            }
            ConsolePrinter.Print(sales);
        }
コード例 #33
0
 /// <summary>
 /// The entry point of the program.
 /// </summary>
 private static void Main()
 {
     ConsolePrinter consolePrinter = new ConsolePrinter();
     consolePrinter.Print(true);
 }
コード例 #34
0
 static void Main()
 {
     var logger = new ConsolePrinter();
     logger.Print("Invalid operation exception");
 }
コード例 #35
0
        public void ConsolePrinterPrint_WhenAStringIsPassed_ShouldPrintTheStringWithoutNewLine()
        {
            // arrange
            var text = "To be printed";
            var printer = new ConsolePrinter();

            // act
            printer.Print(text);

            // assert
            var actual = this.stringWriter.ToString();
            var expected = text;

            Assert.AreEqual(expected, actual);
        }
コード例 #36
0
        public void ConsolePrinterPrint_WhenNullIsPassed_ShouldPrintEmptyString()
        {
            // arrange
            string text = null;
            var printer = new ConsolePrinter();

            // act
            printer.Print(text);

            // assert
            var actual = this.stringWriter.ToString();
            var expected = string.Empty;

            Assert.AreEqual(expected, actual);
        }