コード例 #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);
        }
コード例 #2
0
        public void GetById_CorrectDataGot_ActualEqualExpectedData()
        {
            var expectedUserType = new UserType
            {
                ID          = 1,
                Description = "User"
            };
            UserType actualUserType;

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

            AssertUserTypesEqual(expectedUserType, actualUserType);
        }
コード例 #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);
        }
コード例 #4
0
        public void Update_WasUserTypeUpdated_ActualEqualsExpectedData()
        {
            var expectedUserType = new UserType
            {
                ID          = 1,
                Description = "UpdatedUserType"
            };
            UserType actualUserType;

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

            AssertUserTypesEqual(expectedUserType, actualUserType);
        }