Esempio n. 1
0
        public void TestEqualsAllSame()
        {
            var first = new Assembly(this.SampleAssemblyPath);
            var second = new AssemblyStub("MockEverythingTests.Inspection.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");

            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
        }
Esempio n. 2
0
        public void TestEqualsFullNameDifferent()
        {
            var first = new Assembly(this.SampleAssemblyPath);
            var second = new AssemblyStub("WrongFullName");

            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(second.Equals(first));
        }
Esempio n. 3
0
 public void TestAlterVersion()
 {
     var assembly = new Assembly(this.SampleAssemblyPath);
     assembly.AlterVersion(new Version(3, 0, 14, 5021));
     var actual = assembly.Version;
     var expected = new Version("3.0.14.5021");
     Assert.AreEqual(expected, actual);
 }
        public void TestFindMatchParamsParameterReal()
        {
            var firstAssemblyPath = new Uri(typeof(StringFormat).Assembly.CodeBase).AbsolutePath;
            var secondAssemblyPath = new Uri(typeof(string).Assembly.CodeBase).AbsolutePath;

            var methodFromFirst = new Assembly(firstAssemblyPath).FindType("MockEverythingTests.Engine.Browsers.StringFormat").FindMethods(MemberType.Static).Single();
            var typeFromSecond = new Assembly(secondAssemblyPath).FindType("System.String");

            var actual = new MethodMatching().FindMatch(methodFromFirst, typeFromSecond).Name;

            var expected = "Format";
            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
0
 public void TestFindType()
 {
     var actual = new Assembly(this.SampleAssemblyPath).FindType("MockEverythingTests.Inspection.Demo.SimpleClass").Name;
     var expected = "SimpleClass";
     Assert.AreEqual(expected, actual);
 }
Esempio n. 6
0
 public void TestEqualsWrongType()
 {
     var first = new Assembly(this.SampleAssemblyPath);
     Assert.IsFalse(first.Equals(27));
 }
Esempio n. 7
0
 public void TestEqualsNull()
 {
     var first = new Assembly(this.SampleAssemblyPath);
     Assert.IsFalse(first.Equals(null));
 }
Esempio n. 8
0
 public void TestConstructorWithWrongNameLazy()
 {
     // The assembly shouldn't be loaded when a constructor is called, but only when we actually need it. Thus, calling a constructor with a name shouldn't be a problem.
     var assembly = new Assembly(@"not a real path");
     Assert.IsNotNull(assembly);
 }
Esempio n. 9
0
 public void TestConstructorWithWrongName()
 {
     var assembly = new Assembly(@"not a real path");
     assembly.FindTypes().ToList();
 }
Esempio n. 10
0
 private bool TypeExists(string typeName, MemberType type, params System.Type[] expectedAttributes)
 {
     var assembly = new Assembly(this.SampleAssemblyPath);
     return assembly.FindTypes(type, expectedAttributes).Select(t => t.Name).Contains(typeName);
 }
Esempio n. 11
0
 private bool TypeExists(string typeName)
 {
     var assembly = new Assembly(this.SampleAssemblyPath);
     return assembly.FindTypes().Select(t => t.Name).Contains(typeName);
 }
Esempio n. 12
0
 public void TestGetVersion()
 {
     var actual = new Assembly(this.SampleAssemblyPath).Version;
     var expected = new Version("1.0.0.0");
     Assert.AreEqual(expected, actual);
 }
Esempio n. 13
0
 public void TestGetFilePath()
 {
     var actual = new Assembly(this.SampleAssemblyPath).FilePath;
     var expected = this.SampleAssemblyPath;
     Assert.AreEqual(expected, actual);
 }