コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: TilyaGit/Person
        public void ItShouldGetAverageSalary()
        {
            var personRepository = new FeikPersonRepository();

            personRepository.Persons.Add(new Person {
                Salary = 25000
            });
            personRepository.Persons.Add(new Person {
                Salary = 50000
            });
            personRepository.Persons.Add(new Person {
                Salary = 15000
            });
            PersonController personController = new PersonController(personRepository);

            var contentResult = personController.GetAverageSalary() as OkNegotiatedContentResult <decimal>;

            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(30000, contentResult.Content);
        }