Exemplo n.º 1
0
        public void DeleteById_WasDeleted_actualDataIsNull()
        {
            var      typeIdToDelete = AddandGetTestUserType().ID;
            UserType actualUserType;

            using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME)))
            {
                userTypeRepo.Delete(typeIdToDelete);
                userTypeRepo.SaveChanges();
                actualUserType = userTypeRepo.GetById(typeIdToDelete);
            }

            Assert.IsNull(actualUserType);
        }
Exemplo n.º 2
0
        private UserType AddandGetTestUserType()
        {
            var userTypeType = new UserType
            {
                Description = "TestUserType"
            };

            using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME)))
            {
                userTypeRepo.Add(userTypeType);
                userTypeRepo.SaveChanges();
            }

            return(userTypeType);
        }
Exemplo n.º 3
0
        public void Add_WasUserTypeAdded_ActualEqualsExpectedData()
        {
            var expectedUserType = new UserType
            {
                Description = "NewTestType"
            };
            UserType actualUserType;

            using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME)))
            {
                userTypeRepo.Add(expectedUserType);
                userTypeRepo.SaveChanges();
                actualUserType = userTypeRepo.GetById(expectedUserType.ID);
            }

            AssertUserTypesEqual(expectedUserType, actualUserType);
        }