示例#1
0
 public void Constructor_Identifies_NestedPublicAccessCorrectly()
 {
     var internalStruct = new TypeWrapper(typeof(PublicStruct).Assembly.DefinedTypes.Single(x => x.Name == "NestedPublicStruct"));
     var SUT = new StructTypeData(internalStruct);
     Assert.That(SUT.AccessLevel == AccessLevelEnum.Public);
     Assert.That(SUT.Type == TypeEnum.Struct);
 }
示例#2
0
        public void Constructor_Parses_StructStringInput()
        {
            var testType = new StructTypeData(new TypeWrapper(typeof(PublicStructWithAttributes)));
            var testString = testType.ToString();

            var SUT = new StructTypeData(testString);

            Assert.NotNull(SUT);
            Assert.That(SUT.AccessLevel == AccessLevelEnum.Public);
            Assert.That(SUT.AttributeData.Count == testType.AttributeData.Count);
            Assert.That(SUT.AttributeData.Any(x => x.Name == typeof(TestAttributeAttribute).FullName));
            Assert.That(SUT.Type == testType.Type);
        }
示例#3
0
 public void Constructor_Throws_WhenPassedEnum()
 {
     var SUT = new StructTypeData(new TypeWrapper(typeof(PublicEnum)));
 }
示例#4
0
 public void Constructor_Identifies_PublicAccessCorrectly()
 {
     var SUT = new StructTypeData(new TypeWrapper(typeof(PublicStruct)));
     Assert.That(SUT.AccessLevel == AccessLevelEnum.Public);
     Assert.That(SUT.Type == TypeEnum.Struct);
 }
示例#5
0
 public void Constructor_IdentifiesClassTypesCorrectly()
 {
     var SUT = new StructTypeData(new TypeWrapper(typeof(PublicStruct)));
     Assert.That(SUT.Type == TypeEnum.Struct);
 }
示例#6
0
 public void ToString_BuildsCorrectString_ForPublicStruct()
 {
     var SUT = new StructTypeData(new TypeWrapper(typeof(PublicStruct)));
     var stringRepresentation = SUT.ToString();
     Assert.That(stringRepresentation.StartsWith("\tpublic struct Ntegrity.TestTargetAssembly.PublicStruct"));
 }
示例#7
0
 public void Constructor_Throws_WhenPassedInterface()
 {
     var SUT = new StructTypeData(new TypeWrapper(typeof(IPublicInterface)));
 }