public void Test1()
        {
            //arrange
            var book = new Book();

            book.AddGrade(89.1);
            book.AddGrade(90.6);
            book.AddGrade(67.9);

            //act
            var result = book.GetStatistics();

            //assert
            Assert.Equal(82.5, result.Average, 1);
            Assert.Equal(90.6, result.High, 1);
            Assert.Equal(67.9, result.Low, 1);
        }
Example #2
0
        public void BookCalculateAnAverageGrade()
        {
            //arrange
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            //act
            var result = book.GetStatistics();

            //assert
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
        }
Example #3
0
        public void CheckGrade()
        {
            var book = new Book("");

            book.AddGrade(105.1);

            //need check for over under grade.
        }
        public void Test1()
        {
            // Arrange
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            // Act
            var result = book.GetStatistics();

            // Assert
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
        }
        public void BookCalculatesStats()
        {
            // arrange
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            // act
            var results = book.CalcStats();

            // assert
            Assert.Equal(85.6, results.average, 1);
            Assert.Equal(90.5, results.high, 1);
            Assert.Equal(77.3, results.low, 1);
        }
Example #6
0
        public void BookAddsGradeLess100Greater0()
        {
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(-5.0);

            if (grade <= 100 && grade >= 0)
            {
                grades.Add(grade);
                Console.WriteLine("Grade Added");
            }
            else
            {
                Console.WriteLine("Invalid value");
            }
        }
Example #7
0
        public void BookCalculatesAnAverageGrade()
        {
            // arrange your test data, objects and values
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);


            // act perform method or calculation
            var result = book.GetStatistics();

            //assert something about the value
            Assert.Equal(85.6, result.Average, 1);  // the 1 checks precision to 1 decimal place
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
        }
Example #8
0
        public void BookCalculatesStats()
        {
            // arrange
            var book = new Book("");

            book.AddGrade(68.5);
            book.AddGrade(55.5);
            book.AddGrade(20.0);

            // act
            var result = book.GetStats();

            // assert
            Assert.Equal(68.5, result.High, 1);
            Assert.Equal(20.0, result.Low, 1);
            Assert.Equal(48, result.Average, 1); //3rd parameter is how many deciaml places we are comparing
            Assert.Equal('F', result.Letter);    // avg. result of 48 corresponds to Letter grade 'F'
        }
Example #9
0
        public void BookCalculatesAnAverageGrade()
        {
            //Arrange
            var book = new Book(string.Empty);

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            //Act
            var result = book.GetStatistics();

            //Assert
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
            Assert.Equal('A', result.Letter);
        }
Example #10
0
        public void BookGetStatisticsMethod()
        {
            // arrange
            var book = new Book("");

            book.AddGrade(85);
            book.AddGrade(95);
            book.AddGrade(91);

            // act
            var result = book.GetStatistics();

            // assert
            Assert.Equal(90.3, result.Average, 1);
            Assert.Equal(85, result.Low, 1);
            Assert.Equal(95, result.High, 1);
            Assert.Equal('A', result.Letter);
        }
Example #11
0
        public void BookCalculatesStats()
        {
            //arrange
            var book = new Book("My book");

            book.AddGrade(10.5);
            book.AddGrade(11.3);
            book.AddGrade(7.3);
            book.AddGrade(9.8);

            //act
            var result = book.GetStatistics();

            //assert
            Assert.Equal(9.725, result.Average, 3);
            Assert.Equal(11.3, result.High);
            Assert.Equal(7.3, result.Low);
        }
Example #12
0
        public void BookCalculatesAnAverageGrade()
        {
            //arrange
            var book = new Book("Heyo");

            book.AddGrade(89.1);
            book.AddGrade(98.2);
            book.AddGrade(98.4);
            book.AddGrade(73.8);

            //act
            var stats = book.GetStats();

            //assert
            Assert.Equal(98.4, stats.Max, 1);
            Assert.Equal(89.9, stats.Average, 1);
            Assert.Equal(73.8, stats.Min, 1);
        }
Example #13
0
        public void BookCalculateStats()
        {
            // arrange section
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(-5.1);  //should not add and should not be the low value.
            book.AddGrade(105.0); //should not add and should not be the high value.
            book.AddGrade(88.9);

            // act section
            var result = book.GetStatistics();

            // assert section
            Assert.Equal(89.0, result.Average, 1);
            Assert.Equal(89.1, result.High, 1);
            Assert.Equal(88.9, result.Low, 1);
        }
Example #14
0
        public void BookCalculatesAnAverageGrade()
        {
            // Arrange Section: Sets test data and objects you are going to use for testing
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            // Act Section: Perform and action such as a calculation
            var results = book.GetStatistics();

            // Assert Section: evaluate the action against the expected output
            Assert.Equal(85.6, results.Average, 1);
            Assert.Equal(90.5, results.High, 1);
            Assert.Equal(77.3, results.Low, 1);
            Assert.Equal('B', results.Letter);
        }
Example #15
0
        public void Test1()
        {
            //arrange
            var book = new Book("");

            book.AddGrade(0);
            book.AddGrade(100);
            book.AddGrade(2);
            book.AddGrade(100);

            //act
            var result = book.GetStatistics();

            //assert
            Assert.Equal(50.5, result.Average, 1);
            Assert.Equal(100, result.High, 1);
            Assert.Equal(0, result.Low, 1);
        }
Example #16
0
        public void BookCalculatesanAvgGrade()
        {
            //Arrange
            var book = new Book(""); // Instanciando a classe Book

            book.AddGrade(89.1);     //Adicionando notas
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            //Act
            var result = book.GetStatistics(); //Buscando o metodo que calcula as estatisticas

            //Assert
            Assert.Equal(85.6, result.Average, 1); //comparando a média esperada com o real e utilizando apenas uma casa decimal
            Assert.Equal(90.5, result.High, 1);    //comparando a nota mais alta real com o esperado
            Assert.Equal(77.3, result.Low, 1);     // comparando a nota mais baixa com o esperaso
            Assert.Equal('B', result.Letter);
        }
Example #17
0
        public void BookCalculatesAnAverageGrade()
        {
            // arrange
            var book = new Book("Test");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            // act
            var stats = book.GetStatistics();

            // assert
            Assert.Equal(85.6, stats.Average, 1);
            Assert.Equal(90.5, stats.High, 1);
            Assert.Equal(77.3, stats.Low, 1);
            Assert.Equal('B', stats.Letter);
        }
Example #18
0
        public void BookCalculatesStats()
        {
            // arrange portion -- staging the data and variables you want to test
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            // act portion -- store the calculations or procedures you want to test
            var result = book.GetStats();

            // assert portion -- assert something about the value that was computed
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
            Assert.Equal('B', result.Letter);
        }
Example #19
0
        public void BookCalculatesAverageGrade()
        {
            // Arrange Section
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            // Acting or Perform Section
            var result = book.GetStats();

            // Assert
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
            Assert.Equal('B', result.Letter);
        }
Example #20
0
        public void BookCalculatesAverageGrade()
        {
            //arrange- data to be acted on
            var book = new Book("test");

            book.AddGrade(88.3);
            book.AddGrade(77.9);
            book.AddGrade(88.6);

            //act- on data
            var result = book.GetStatistics();

            //assert
            Assert.Equal(84.9, result.Average, 1);
            Assert.Equal(77.9, result.Low);
            Assert.Equal(88.6, result.High);
            Assert.Equal('B', result.Letter);
        }
Example #21
0
        public void BookCalculatesAnAverageGrade()
        {
            // arrange section: objects and values
            var book = new Book("", "", "");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            // the act section
            var result = book.GetStatistics();

            // assert section
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
            Assert.Equal('B', result.Letter);
        }
Example #22
0
        public void TestStatistics()
        {
            //Given
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.1);
            book.AddGrade(77.3);

            //When
            var result = book.ShowStatistics();


            //Then
            Assert.AreEqual(85.5, result.Average);
            Assert.AreEqual(90.1, result.High);
            Assert.AreEqual(77.3, result.Low);
        }
Example #23
0
        public void BookCalculatesAnAverageGrade()
        {
            //Arrange
            var book = new Book("Hudas Grades");

            book.AddGrade(90.5);
            book.AddGrade(93.6);
            book.AddGrade(89.6);


            //Act
            var result = book.GetStatistics();

            //Assert
            Assert.Equal(91.2, result.Average, 1);
            Assert.Equal(93.6, result.High, 1);
            Assert.Equal(89.6, result.Low, 1);
        }
Example #24
0
        public void BookCalculatesAnAverageGrade()
        {
            //arrange
            var book = new Book("");

            book.AddGrade(89);
            book.AddGrade(90);
            book.AddGrade(77);

            //act
            var result = book.GetStatistics();

            // assert
            Assert.Equal(85, result.Average);
            Assert.Equal(90, result.High);
            Assert.Equal(77, result.Low);
            Assert.Equal('B', result.Letter);
        }
Example #25
0
        public void BookCalculatesAnAverage()
        {
            //Arrange
            var book = new Book("Manoj's Book");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            //Act
            var result = book.GetStatistics();

            //Assert
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.Max);
            Assert.Equal(77.3, result.Min);
            Assert.Equal('B', result.LetterGrade);
        }
Example #26
0
        public void BookCalculatesStats()
        {
            //arrange
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            //act
            var result = book.GetStats();

            //assert
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High);
            Assert.Equal(77.3, result.Low);
            Assert.Equal('B', result.Letter);
        }
        public void BookCalculateStatistics()
        {
            // Arrange Section
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);
            // Act Section
            var result = book.GetStatistics();

            // Assert Section
            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
            Assert.Equal('B', result.Letter);
            //Assert.Equal(expected,actual);
        }
Example #28
0
        public void BookCalculatesAnAvatageGrade()
        {
            //arrange
            var book = new Book("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(79.8);
            book.AddGrade(85.6);

            //act
            var result = book.GetStatistics();

            //Object
            Object.Equals(85.6, result.Avarage);
            Object.Equals(90.5, result.High);
            Object.Equals(79.8, result.High);
        }
Example #29
0
        public void BookCalculatesAnAverageGrade()
        {
            //  arrange
            var book = new Book
            {
                Name = "Book 1"
            };

            book.AddGrade(89.54);
            book.AddGrade(56.8);
            book.AddGrade(32.23);
            // act
            var result = book.GetStatistic();

            // assert
            Assert.Equal(89.54, result.High);
            Assert.Equal(32.23, result.Low);
        }
Example #30
0
        public void Test1()
        {
            //arrange
            var book = new Book("");

            book.AddGrade(12.1);
            book.AddGrade(30.0);
            book.AddGrade(96.2);

            //act
            var result = book.GetStats();

            //assert

            Assert.Equal(12.1, result.Low, 1);
            Assert.Equal(96.2, result.High, 1);
            Assert.Equal(46.1, result.Average, 1);
        }