Ejemplo n.º 1
0
        public void Can_Perform_Exists_On_Repository()
        {
            // Arrange
            var provider   = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();

            using (var repository = new ServerRegistrationRepository(unitOfWork))
            {
                // Act
                var exists      = repository.Exists(3);
                var doesntExist = repository.Exists(10);

                // Assert
                Assert.That(exists, Is.True);
                Assert.That(doesntExist, Is.False);
            }
        }
        public void Can_Perform_Exists_On_Repository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (provider.CreateScope())
            {
                ServerRegistrationRepository repository = CreateRepository(provider);

                // Act
                bool exists      = repository.Exists(3);
                bool doesntExist = repository.Exists(10);

                // Assert
                Assert.That(exists, Is.True);
                Assert.That(doesntExist, Is.False);
            }
        }
Ejemplo n.º 3
0
        public void Can_Perform_Delete_On_Repository()
        {
            // Arrange
            var provider   = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();

            using (var repository = new ServerRegistrationRepository(unitOfWork))
            {
                // Act
                var server = repository.Get(3);
                Assert.IsNotNull(server);
                repository.Delete(server);
                unitOfWork.Commit();

                var exists = repository.Exists(3);

                // Assert
                Assert.That(exists, Is.False);
            }
        }
        public void Can_Perform_Delete_On_Repository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (provider.CreateScope())
            {
                ServerRegistrationRepository repository = CreateRepository(provider);

                // Act
                IServerRegistration server = repository.Get(3);
                Assert.IsNotNull(server);
                repository.Delete(server);

                bool exists = repository.Exists(3);

                // Assert
                Assert.That(exists, Is.False);
            }
        }
        public void Can_Perform_Exists_On_Repository()
        {
            // Arrange
            var provider = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            using (var repository = new ServerRegistrationRepository(unitOfWork))
            {
                // Act
                var exists = repository.Exists(3);
                var doesntExist = repository.Exists(10);

                // Assert
                Assert.That(exists, Is.True);
                Assert.That(doesntExist, Is.False);    
            }
        }
        public void Can_Perform_Delete_On_Repository()
        {
            // Arrange
            var provider = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            using (var repository = new ServerRegistrationRepository(unitOfWork))
            {
                // Act
                var server = repository.Get(3);
                Assert.IsNotNull(server);
                repository.Delete(server);
                unitOfWork.Commit();

                var exists = repository.Exists(3);

                // Assert
                Assert.That(exists, Is.False);   
            }            
        }