コード例 #1
0
        public void EatVariableType_NullTypeTest()
        {
            // Arrange
            var typeEater = new TypeEater(Mock.Of <EatExpressionHelper>());

            // Assert
            Assert.Throws <ArgumentNullException>(() => typeEater.EatVariableType(Mock.Of <ISnapshot>(), null));
        }
コード例 #2
0
        public void EatCastType_NullSnapshotTest()
        {
            // Arrange
            var typeEater = new TypeEater(Mock.Of <EatExpressionHelper>());

            // Assert
            Assert.Throws <ArgumentNullException>(() => typeEater.EatCastType(null, Mock.Of <ITypeUsage>()));
        }
コード例 #3
0
        public void EatVariableType_TargetTest()
        {
            // Arrange
            var snapshot  = Mock.Of <ISnapshot>(t => t.IsInTestScope("ModuleName") == true);
            var type      = Mock.Of <IType>();
            var helper    = Mock.Of <EatExpressionHelper>(t => t.GetTypeClass(type) == Mock.Of <ITypeElement>(e => e.Module.Name == "ModuleName"));
            var typeEater = new TypeEater(helper);

            // Act
            var kind = typeEater.EatVariableType(snapshot, type);

            // Assert
            Assert.AreEqual(kind, ExpressionKind.Target);
        }
コード例 #4
0
        public void EatCastType_PredefinedAsStubCandidateTest()
        {
            // Arrange
            var snapshot  = Mock.Of <ISnapshot>();
            var typeUsage = Mock.Of <IPredefinedTypeUsage>();;
            var helper    = Mock.Of <EatExpressionHelper>();
            var typeEater = new TypeEater(helper);

            // Act
            var kind = typeEater.EatCastType(snapshot, typeUsage);

            // Assert
            Assert.AreEqual(kind, ExpressionKind.StubCandidate);
        }
コード例 #5
0
        public void EatCastType_UserTypeAsStubCandidateTest()
        {
            // Arrange
            var snapshot  = Mock.Of <ISnapshot>(t => t.IsInTestScope("ModuleName") == false && t.IsInTestProject("ModuleName") == false);
            var typeUsage = Mock.Of <IUserTypeUsage>();
            var classType = Mock.Of <ITypeElement>(t => t.Module.Name == "ModuleName");
            var helper    = Mock.Of <EatExpressionHelper>(t => t.GetUserTypeUsageClass(typeUsage) == classType);
            var typeEater = new TypeEater(helper);

            // Act
            var kind = typeEater.EatCastType(snapshot, typeUsage);

            // Assert
            Assert.AreEqual(kind, ExpressionKind.StubCandidate);
        }