Example #1
0
        public void FirstNameTooLong_ShouldThrow(TestContextFixture testContextFixture,
                                                 AddUser.Command addUser)
        {
            //arrange
            addUser.FirstName = "Hottentottentententtentoonstelling";

            //act
            Should.Throw <DbUpdateException>(() => testContextFixture.Send(addUser));
        }
Example #2
0
        public void ShouldAddNewUser(TestContextFixture testContextFixture,
                                     AddUser.Command addUser)
        {
            //act
            testContextFixture.Send(addUser);

            //assert
            User saved = null;

            testContextFixture.DoClean(
                context => saved = context.Set <User>()
                                   .SingleOrDefault(s => s.Email == addUser.Email)
                );
            saved.ShouldNotBeNull();
        }
Example #3
0
        public void Should_create(TestContextFixture fixture, Department dept)
        {
            fixture.SaveAll(dept);

            var command = new Create.Command
            {
                Title = "Blarg",
                Credits = 10,
                Department = dept
            };

            fixture.Send(command);

            Course course = null;

            fixture.DoClean(ctx => course = ctx.Set<Course>().FirstOrDefault(c => c.Title == command.Title));

            course.Title.ShouldBe(command.Title);
            course.Credits.ShouldBe(command.Credits);
            course.DepartmentID.ShouldBe(dept.DepartmentID);
        }
        public void Should_create(TestContextFixture fixture, Department dept)
        {
            fixture.SaveAll(dept);

            var command = new Create.Command
            {
                Title      = "Blarg",
                Credits    = 10,
                Department = dept
            };

            fixture.Send(command);

            Course course = null;

            fixture.DoClean(ctx => course = ctx.Set <Course>().FirstOrDefault(c => c.Title == command.Title));

            course.Title.ShouldBe(command.Title);
            course.Credits.ShouldBe(command.Credits);
            course.DepartmentID.ShouldBe(dept.DepartmentID);
        }