Esempio n. 1
0
        public void TestAdd()
        {
            //Arrange
            ServiceContext c          = new ServiceContext();
            var            fakeRepo   = new FakeServicesRepository();
            var            controller = new ServicesController(fakeRepo, c);
            var            Service    = new ServiceModel()
            {
                ServiceID          = 0,
                ServiceName        = "SomeJob",
                ServiceDescription = "FAKE REPO TEST",
                ServiceEstimated   = "more for testing the repo fake",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };

            //Act
            controller.Edit(Service);

            // Assert Checking that story was added.
            var retrievedService = fakeRepo.service.ToList()[0];

            Assert.NotNull(retrievedService.ServiceName);
        }
Esempio n. 2
0
        public void TestRemove()
        {
            //Arrange
            ServiceContext c          = new ServiceContext();
            var            fakeRepo   = new FakeServicesRepository();
            var            controller = new ServicesController(fakeRepo, c);
            var            Service    = new ServiceModel()
            {
                ServiceID          = 0,
                ServiceName        = "SomeJob",
                ServiceDescription = "FAKE REPO TEST",
                ServiceEstimated   = "more for testing the repo fake",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };

            //Act
            controller.Edit(Service);   // adds
            controller.Delete(Service); // and deletes

            // Assert Checking that story was added.

            Assert.Empty(fakeRepo.service);
        }
Esempio n. 3
0
 public UserControllerTest()
 {
     _service        = new FakePlayerService();
     _authService    = new FakeAuthService();
     _authRepository = new AuthRepository();
     _repository     = new FakeServicesRepository();
     _controller     = new UserController(_service, new Mock <ILogger <UserController> >().Object, _authService);
 }
Esempio n. 4
0
 public GameControllerTest()
 {
     _authRepository = new AuthRepository();
     _repository     = new FakeServicesRepository();
     _gameService    = new FakeGameService(_repository);
     _authService    = new FakeAuthService();
     _playerService  = new FakePlayerService();
     _controller     = new GameController(_gameService, _authService, new Mock <ILogger <GameController> >().Object);
 }
Esempio n. 5
0
        public void TestUpdateService()
        {
            ServiceContext c          = new ServiceContext();
            var            fakeRepo   = new FakeServicesRepository();
            var            controller = new ServicesController(fakeRepo, c);
            var            Service    = new ServiceModel()
            {
                ServiceID          = 0,
                ServiceName        = "SomeJob",
                ServiceDescription = "FAKE REPO TEST",
                ServiceEstimated   = "more for testing the repo fake",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };
            var Service2 = new ServiceModel()
            {
                ServiceID          = 1,
                ServiceName        = "Test2",
                ServiceDescription = "FAKE REPO TEST2",
                ServiceEstimated   = "more for testing the repo fake2",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };
            var Service3 = new ServiceModel()
            {
                ServiceID          = 1,
                ServiceName        = "Test3",
                ServiceDescription = "FAKE REPO TEST3",
                ServiceEstimated   = "more for testing the repo fake3",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };

            //Act
            controller.Edit(Service);
            controller.Edit(Service2);
            controller.Edit(Service3);
            //Assert
            // Assert Checking that story was added.
            ServiceModel retrievedService = fakeRepo.service.ToList()[0];

            Assert.Equal("FAKE REPO TEST3", retrievedService.ServiceDescription);
        }
Esempio n. 6
0
        public void TestGetByIdService()
        {
            ServiceContext c          = new ServiceContext();
            var            fakeRepo   = new FakeServicesRepository();
            var            controller = new ServicesController(fakeRepo, c);
            var            Service    = new ServiceModel()
            {
                ServiceID          = 0,// Add the item will put the count for that
                ServiceName        = "SomeJob",
                ServiceDescription = "FAKE REPO TEST",
                ServiceEstimated   = "more for testing the repo fake",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };
            var Service2 = new ServiceModel()
            {
                ServiceID          = 0,// Add the item will put the count for that
                ServiceName        = "Test2",
                ServiceDescription = "FAKE REPO TEST2",
                ServiceEstimated   = "more for testing the repo fake2",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };
            var Service3 = new ServiceModel()
            {
                ServiceID          = 0,// Add the item will put the count for that
                ServiceName        = "Test3",
                ServiceDescription = "FAKE REPO TEST3",
                ServiceEstimated   = "more for testing the repo fake3",
                ServicePrice       = 80,
                User = new User()
                {
                    UserId = "1", UserName = "******", UserLast = "Fake2"
                },
            };

            //Act
            controller.Edit(Service);
            controller.Edit(Service2);
            controller.Edit(Service3);
            //Assert
            // Assert Checking that story was added.
            ServiceModel Service4 = fakeRepo.GetServiceById(2); // that should retrieve Service3

            Assert.Equal("FAKE REPO TEST3", Service4.ServiceDescription);
        }
Esempio n. 7
0
 public FakeGameService(FakeServicesRepository repository)
 {
     _repository = repository;
 }
Esempio n. 8
0
 public FakeGameService()
 {
     _repository = new FakeServicesRepository();
 }
Esempio n. 9
0
 public FakePlayerService()
 {
     _repository = new FakeServicesRepository();
 }
Esempio n. 10
0
 public FakeAuthService()
 {
     _repository = new FakeServicesRepository();
 }