NUnit.Framework.Assert.IsAssignableFrom(System.Type, object)

Here are the examples of the csharp api class NUnit.Framework.Assert.IsAssignableFrom(System.Type, object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

32 Examples 7

1. Example

Project: ContinuousTests
Source File: TypeAssertTest.cs
View license
[Test()]
        public void IsAssignableFrom()
        {
            int[] array10 = new int[10];

            Assert.IsAssignableFrom(typeof(int[]), array10);
            Expect(array10, AssignableFrom(typeof(int[])));
#if NET_2_0
            Assert.IsAssignableFrom<int[]>(array10);
#endif
        }

2. Example

View license
[Test]
        public void Collection_of_Output_Lines_is_Returned()
        {
            var outputFormatter = new OutputFormatter();

            IList<string> formattedOutput = outputFormatter.Format(_generatedPrimes);

            Assert.IsAssignableFrom(typeof (List<string>), formattedOutput);
        }

3. Example

Project: UnityAutoMoq
Source File: CoreTdd.cs
View license
public static object ShouldBeOfType(this object actual, Type expected)
        {
            Assert.IsAssignableFrom(expected, actual);
            return actual;
        }

4. Example

Project: UnityAutoMoq
Source File: CoreTdd.cs
View license
public static TExpected ShouldBeOfType<TExpected>(this object actual)
        {
            Assert.IsAssignableFrom(typeof(TExpected), actual);
            return (TExpected)actual;
        }

5. Example

Project: AutoTest.Net
Source File: TypeAssertTest.cs
View license
[Test()]
        public void IsAssignableFrom()
        {
            int[] array10 = new int[10];

            Assert.IsAssignableFrom(typeof(int[]), array10);
            Expect(array10, AssignableFrom(typeof(int[])));
#if NET_2_0
            Assert.IsAssignableFrom<int[]>(array10);
#endif
        }

6. Example

Project: AutoTest.Net
Source File: TypeAssertTest.cs
View license
[Test()]
        public void IsAssignableFrom()
        {
            int[] array10 = new int[10];

            Assert.IsAssignableFrom(typeof(int[]), array10);
            Expect(array10, AssignableFrom(typeof(int[])));
#if CLR_2_0 || CLR_4_0
            Assert.IsAssignableFrom<int[]>(array10);
#endif
        }

7. Example

Project: AutoTest.Net
Source File: TypeAssertTest.cs
View license
[Test()]
        public void IsAssignableFrom()
        {
            int[] array10 = new int[10];

            Assert.IsAssignableFrom(typeof(int[]), array10);
            Expect(array10, AssignableFrom(typeof(int[])));
#if NET_2_0
            Assert.IsAssignableFrom<int[]>(array10);
#endif
        }

8. Example

Project: ContinuousTests
Source File: TypeAssertTest.cs
View license
[Test()]
        public void IsAssignableFrom()
        {
            int[] array10 = new int[10];

            Assert.IsAssignableFrom(typeof(int[]), array10);
            Expect(array10, AssignableFrom(typeof(int[])));
#if CLR_2_0 || CLR_4_0
            Assert.IsAssignableFrom<int[]>(array10);
#endif
        }

9. Example

Project: ContinuousTests
Source File: TypeAssertTest.cs
View license
[Test()]
        public void IsAssignableFrom()
        {
            int[] array10 = new int[10];

            Assert.IsAssignableFrom(typeof(int[]), array10);
            Expect(array10, AssignableFrom(typeof(int[])));
#if NET_2_0
            Assert.IsAssignableFrom<int[]>(array10);
#endif
        }

10. Example

View license
[Test]
        public void New_TryDequeue_TryEnqueue_TryDequeue_TryDequeue_ConsumerCount() {
            Action<int> value;
            var q = new LockFreeItemConsumerQueue<int>();
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryEnqueue(x => { });
            Assert.AreEqual(1, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.IsAssignableFrom(typeof(Action<int>), value);
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);
        }

11. Example

View license
[Test]
        public void New_TryEnqueue_TryDequeue_ConsumerCount() {
            Action<int> value;
            var q = new LockFreeItemConsumerQueue<int>();
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryEnqueue(x => { });
            Assert.AreEqual(1, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.IsAssignableFrom(typeof(Action<int>), value);
            Assert.AreEqual(0, q.ConsumerCount);
        }

12. Example

View license
[Test]
        public void New_TryDequeue_TryEnqueue_x50_TryDequeue_x50_TryDequeue_ConsumerCount() {
            Action<int> value;
            var q = new LockFreeItemConsumerQueue<int>();
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryEnqueue(x => { });
            }
            Assert.AreEqual(50, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryDequeue(out value);
                Assert.IsAssignableFrom(typeof(Action<int>), value);
            }
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);
        }

13. Example

View license
[Test]
        public void New_TryEnqueue_x50_ConsumerCount() {
            Action<int> value;
            var q = new LockFreeItemConsumerQueue<int>();
            Assert.AreEqual(0, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryEnqueue(x => { });
            }
            Assert.AreEqual(50, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryDequeue(out value);
                Assert.IsAssignableFrom(typeof(Action<int>), value);
            }
            Assert.AreEqual(0, q.ConsumerCount);
        }

14. Example

View license
[Test]
        public void New_TryDequeue_TryEnqueue_TryDequeue_ConsumerCount() {
            Action<int> value;
            var q = new LockFreeItemConsumerQueue<int>();
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryEnqueue(x => { });
            Assert.AreEqual(1, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.IsAssignableFrom(typeof(Action<int>), value);
            Assert.AreEqual(0, q.ConsumerCount);
        }

15. Example

View license
[Test]
        public void New_TryEnqueue_x50_TryDequeue_x50_TryDequeue_ConsumerCount() {
            Action<int> value;
            var q = new LockFreeItemConsumerQueue<int>();
            Assert.AreEqual(0, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryEnqueue(x => { });
            }
            Assert.AreEqual(50, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryDequeue(out value);
                Assert.IsAssignableFrom(typeof(Action<int>), value);
            }
            Assert.AreEqual(0, q.ConsumerCount);

            q.TryDequeue(out value);
            Assert.AreEqual(0, q.ConsumerCount);
        }

16. Example

View license
[Test]
        public void New_TryEnqueue_x50_TryDequeue_x50_ConsumerCount() {
            Action<int> value;
            var q = new LockFreeItemConsumerQueue<int>();
            Assert.AreEqual(0, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryEnqueue(x => { });
            }
            Assert.AreEqual(50, q.ConsumerCount);

            for(int i = 0; i < 50; ++i) {
                q.TryDequeue(out value);
                Assert.IsAssignableFrom(typeof(Action<int>), value);
            }
            Assert.AreEqual(0, q.ConsumerCount);
        }

17. Example

View license
[Test]
        public void DownMigrationsAreInReverseOrderOfUpMigrations()
        {
            var autoReversibleMigration = new TestAutoReversingMigration();
            context.Object.Expressions = new Collection<IMigrationExpression>();
            autoReversibleMigration.GetDownExpressions(context.Object);

            Assert.IsAssignableFrom(typeof(RenameTableExpression), context.Object.Expressions.ToList()[0]);
            Assert.IsAssignableFrom(typeof(DeleteTableExpression), context.Object.Expressions.ToList()[1]);
        }

18. Example

Project: FileHelpers
Source File: EnumConverter.cs
View license
[Test]
        public void EnumNumeric()
        {
            var engine = new FileHelperEngine<EnumType5>();
            using (var temp = new TempFileFactory())
            {
                EnumType5[] data = new EnumType5[] { new EnumType5() { EnumValue = Enum2.One } };

                //write data to file using approprppriate conversion style
                engine.WriteFile(temp.FileName, data);

                //read data back
                data = engine.ReadFile(temp.FileName);

                Assert.IsAssignableFrom(typeof(EnumType5), data[0]);
                Assert.AreEqual(data[0].EnumValue, Enum2.One);
            }
        }

19. Example

Project: FileHelpers
Source File: EnumConverter.cs
View license
[Test]
        public void EnumString()
        {
            var engine = new FileHelperEngine<EnumType4>();

            using (var temp = new TempFileFactory())
            {
                EnumType4[] data = new EnumType4[] { new EnumType4() { EnumValue = Enum2.One } };

                //write data to file using approprppriate conversion style
                engine.WriteFile(temp.FileName, data);

                //read data back
                data = engine.ReadFile(temp.FileName);

                Assert.IsAssignableFrom(typeof(EnumType4), data[0]);
                Assert.AreEqual(data[0].EnumValue, Enum2.One);

            }
        }

20. Example

Project: nunit
Source File: TypeAssertTest.cs
View license
[Test()]
        public void IsAssignableFrom()
        {
            int[] array10 = new int[10];

            Assert.IsAssignableFrom(typeof(int[]), array10);
            Assert.That(array10, Is.AssignableFrom(typeof(int[])));
            Assert.IsAssignableFrom<int[]>(array10);
        }

21. Example

View license
[Test]
        public void ReadNextEntityBlob()
        {
            MemoryStream input = new MemoryStream(UTF8Encoding.UTF8.GetBytes(Properties.Resources.ResponseWithBlob));
            
            XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(input, XmlDictionaryReaderQuotas.Max);

            EntityCollectionResponseParser<TestEntity> parser = new EntityCollectionResponseParser<TestEntity>();
            TestEntity entity = parser.ReadNextEntity(reader);
            Assert.AreEqual(8, entity.Properties.Count);

            Assert.AreEqual("Admin", entity.Properties["Owner"].ToString());
            Assert.AreEqual(new Guid("feba4a52-7b75-47fc-90ff-a4aeb995f607"), (Guid)entity.Properties["FileId"]);
            Assert.AreEqual(false, (bool)entity.Properties["IsDeleted"]);

            Assert.IsAssignableFrom(typeof(string[]), entity.Properties["SomeStringArray"]);
            Assert.AreEqual(3, ((string[])entity.Properties["SomeStringArray"]).Length);
            Assert.AreEqual("item 1", ((string[])entity.Properties["SomeStringArray"])[0]);
            Assert.AreEqual("item 2", ((string[])entity.Properties["SomeStringArray"])[1]);
            Assert.AreEqual("last item", ((string[])entity.Properties["SomeStringArray"])[2]);
        }

22. Example

Project: AutoTest.Net
Source File: AssertSyntaxTests.cs
View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

23. Example

Project: AutoTest.Net
Source File: AssertSyntaxTests.cs
View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

24. Example

Project: AutoTest.Net
Source File: AssertSyntaxTests.cs
View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

25. Example

Project: Pash
Source File: AssertSyntaxTests.cs
View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

26. Example

View license
[Test]
        public void AssignableFromTypeTests()
        {
            // Classic syntax
            Assert.IsAssignableFrom(typeof(string), "Hello");
            Assert.IsNotAssignableFrom(typeof(string), 5);

            // Constraint Syntax
            Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
            Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
            
            // Inherited syntax
            Expect( "Hello", AssignableFrom(typeof(string)));
            Expect( 5, Not.AssignableFrom(typeof(string)));
        }

27. Example

Project: grisu.net
Source File: AssertSyntaxTests.cs
View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

28. Example

View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

29. Example

View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

30. Example

View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

31. Example

View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}

32. Example

View license
[Test]
		public void AssignableFromTypeTests()
		{
			// Classic syntax
			Assert.IsAssignableFrom(typeof(string), "Hello");
			Assert.IsNotAssignableFrom(typeof(string), 5);

			// Helper syntax
			Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
			Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
			
			// Inherited syntax
			Expect( "Hello", AssignableFrom(typeof(string)));
			Expect( 5, Not.AssignableFrom(typeof(string)));
		}