public void SetUp()
 {
     var fakeDbSet = new FakeRepository<Student>();
     fakeBackingCollection = fakeDbSet.BackingCollection;
     unitOfWorkWithFake = new Mock<IStudentUnitOfWork>();
     unitOfWorkWithFake.SetupGet(c => c.Students).Returns(fakeDbSet);
     serviceWithFake = new StudentService(unitOfWorkWithFake.Object);
 }
 public void SetUp()
 {
     mockBackingCollection = new List<Student>();
     mockRepository = new Mock<IRepository<Student>>();
     mockRepository.Setup(r => r.ElementType).Returns(() => mockBackingCollection.AsQueryable().ElementType);
     mockRepository.Setup(r => r.Expression).Returns(() => mockBackingCollection.AsQueryable().Expression);
     mockRepository.Setup(r => r.Provider).Returns(() => mockBackingCollection.AsQueryable().Provider);
     unitOfWorkWithMock = new Mock<IStudentUnitOfWork>();
     unitOfWorkWithMock.SetupGet(u => u.Students).Returns(mockRepository.Object);
     serviceWithMock = new StudentService(unitOfWorkWithMock.Object);
 }
Example #3
0
        static void Main(string[] args)
        {
            service = Windsor.Container.Resolve<StudentService>();

            Console.WriteLine("IUNITOFWORK");

            Console.WriteLine("Current students:");
            ListCurrentStudents();

            Console.WriteLine("Creating new students");
            service.CreateStudents();

            Console.WriteLine("Current students:");
            ListCurrentStudents();

            Console.WriteLine("Promoting all classes");
            service.PromoteAllClasses();

            Console.WriteLine("Current students:");
            ListCurrentStudents();

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
Example #4
0
        static void Main(string[] args)
        {
            service = Windsor.Container.Resolve <StudentService>();

            Console.WriteLine("IUNITOFWORK");

            Console.WriteLine("Current students:");
            ListCurrentStudents();

            Console.WriteLine("Creating new students");
            service.CreateStudents();

            Console.WriteLine("Current students:");
            ListCurrentStudents();

            Console.WriteLine("Promoting all classes");
            service.PromoteAllClasses();

            Console.WriteLine("Current students:");
            ListCurrentStudents();

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }