예제 #1
0
        public void BuildResult_WhenMetricNotInRange_ThrowsException()
        {
            //Given
            WidaTestBuilder builder = new WidaTestBuilder(new TestAssigner(), new BogusFabricator());
            TestSession     session = new TestSession();
            TestSection     section = new TestSection();
            Student         student = new Student();
            DateTime        date    = DateTime.Now;

            //When, Then
            Assert.Throws <ArgumentException>(() => builder.BuildResult(section, date));
        }
예제 #2
0
        public void BuildResult_ReturnsResultWithScore(TestMetric metric, int scoreFrom, int scoreTo)
        {
            // Given
            WidaTestBuilder builder = new WidaTestBuilder(new TestAssigner(), new BogusFabricator());
            TestSession     session = new TestSession();
            TestSection     section = new TestSection()
            {
                Metric = metric
            };
            Student  student = new Student();
            DateTime date    = DateTime.Now;
            // When
            TestResult result = builder.BuildResult(section, date);

            // Then
            Assert.NotNull(result.Score);
            Assert.InRange(Int32.Parse(result.Score), scoreFrom, scoreTo);
        }
예제 #3
0
        public void BuildResult_ReturnsPopulatedResult()
        {
            //Given
            WidaTestBuilder builder = new WidaTestBuilder(new TestAssigner(), new BogusFabricator());
            TestSession     session = new TestSession();
            TestSection     section = new TestSection()
            {
                Metric = TestMetric.Point0To15
            };
            Student  student = new Student();
            DateTime date    = DateTime.Now;
            //When
            TestResult result = builder.BuildResult(section, date);

            //Then
            Assert.NotEqual(Guid.Empty, result.Id);
            Assert.Equal(section, result.Section);
            Assert.Equal(date, result.Date);
        }