NUnit.Framework.Assert.IsInstanceOf(object)

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

200 Examples 7

1. Example

View license
public static T ShouldBeOfType<T>(this object actual) where T : class
        {
            Assert.IsInstanceOf<T>(actual);
            return actual as T;
        }

2. Example

View license
[Test]
        public void Boost_ReturnsDateRangeQuery()
        {
            var query = new DateRangeQuery().Boost(2.2);

            Assert.IsInstanceOf<DateRangeQuery> (query);
        }

3. Example

View license
[Test]
        public void SetException_KeyNotFound_Sets_CasMismatchException_When_Not_Add()
        {
            var result = new OperationResult
            {
                Status = ResponseStatus.KeyExists,
                OpCode = OperationCode.Get
            };

            result.SetException();
            Assert.IsInstanceOf<CasMismatchException>(result.Exception);
        }

4. Example

View license
[Test]
        public void SetException_KeyNotFound_Sets_DocumentAlreadyExistsException()
        {
            var result = new OperationResult
            {
                Status = ResponseStatus.KeyExists,
                OpCode = OperationCode.Add
            };

            result.SetException();
            Assert.IsInstanceOf<DocumentAlreadyExistsException>(result.Exception);
        }

5. Example

View license
[Test]
        public void Boost_ReturnsBooleanQuery()
        {
            var query = new BooleanQuery().Boost(2.2);

            Assert.IsInstanceOf<BooleanQuery>(query);
        }

6. Example

View license
[TestCase(ResponseStatus.ValueTooLarge)]
        [TestCase(ResponseStatus.InvalidArguments)]
        [TestCase(ResponseStatus.ItemNotStored)]
        [TestCase(ResponseStatus.IncrDecrOnNonNumericValue)]
        [TestCase(ResponseStatus.VBucketBelongsToAnotherServer)]
        [TestCase(ResponseStatus.AuthenticationError)]
        [TestCase(ResponseStatus.AuthenticationContinue)]
        [TestCase(ResponseStatus.InvalidRange)]
        [TestCase(ResponseStatus.UnknownCommand)]
        [TestCase(ResponseStatus.OutOfMemory)]
        [TestCase(ResponseStatus.NotSupported)]
        [TestCase(ResponseStatus.InternalError)]
        [TestCase(ResponseStatus.Busy)]
        [TestCase(ResponseStatus.TemporaryFailure)]
        public void SetException_Should_Set_TemporaryLockFailureException_When_Message_Contatains_LOCKED(ResponseStatus status)
        {
            var operationResult = new OperationResult
            {
                Success = false,
                Status = status,
                Message = "error - LOCK_ERROR"
            };

            operationResult.SetException();
            Assert.IsInstanceOf<TemporaryLockFailureException>(operationResult.Exception);
        }

7. Example

View license
[Test]
        public void JsonSettings_With_Null_ContractResolver_Defaults_To_DefaultContractResolver()
        {
            JsonConvert.DefaultSettings = null; // no default settings available

            // Arrange
            var deserializationSettings = new JsonSerializerSettings
            {
                ContractResolver = null
            };
            var serializationSettings = new JsonSerializerSettings
            {
                ContractResolver = null
            };

            // Act
            var serializer = new DefaultSerializer(deserializationSettings, serializationSettings);

            // Assert
            Assert.IsInstanceOf<DefaultContractResolver>(serializer.DeserializationSettings.ContractResolver);
            Assert.IsInstanceOf<DefaultContractResolver>(serializer.SerializerSettings.ContractResolver);
        }

8. Example

View license
[Test]
        public void Boost_ReturnsPrefixQuery()
        {
            var query = new MatchQuery("somematchquery").Boost(2.2);

            Assert.IsInstanceOf<MatchQuery> (query);
        }

9. Example

View license
[Test]
        public void SetException_Should_Set_CasMismatchException_When_Status_Is_DocumentMutationDetected()
        {
            var operationResult = new OperationResult
            {
                Success = false,
                Status = ResponseStatus.DocumentMutationDetected
            };

            operationResult.SetException();
            Assert.IsInstanceOf<CasMismatchException>(operationResult.Exception);
        }

10. Example

View license
[Test]
        public void SetException_Should_Set_DocumentAlreadyExistsException_When_Status_Is_KeyExists_And_OpCode_Is_Add()
        {
            var operationResult = new OperationResult
            {
                Success = false,
                Status = ResponseStatus.KeyExists,
                OpCode = OperationCode.Add
            };

            operationResult.SetException();

            Assert.IsInstanceOf<DocumentAlreadyExistsException>(operationResult.Exception);
        }

11. Example

View license
[Test]
        public void Boost_ReturnsFuzzyQuery()
        {
            var query = new TermQuery("theterm").Boost(2.2);

            Assert.IsInstanceOf<TermQuery> (query);
        }

12. Example

View license
[Test]
        public void SetException_Should_Set_DocumentDoesNotExistException_When_Status_Is_KeyNotFound()
        {
            var operationResult = new OperationResult
            {
                Success = false,
                Status = ResponseStatus.KeyNotFound
            };

            operationResult.SetException();

            Assert.IsInstanceOf<DocumentDoesNotExistException>(operationResult.Exception);
        }

13. Example

View license
[Test]
        public void Boost_ReturnsMatchPhraseQuery()
        {
            var query = new MatchPhraseQuery("phrase").Boost(2.2);

            Assert.IsInstanceOf<MatchPhraseQuery> (query);
        }

14. Example

View license
[Test]
        public void Boost_ReturnsConjunctionQuery()
        {
            var query = new ConjunctionQuery().Boost(2.2);

            Assert.IsInstanceOf<ConjunctionQuery> (query);
        }

15. Example

View license
[Test]
        public void Boost_ReturnsRegexQuery()
        {
            var query = new RegexpQuery("*").Boost(2.2);

            Assert.IsInstanceOf<RegexpQuery> (query);
        }

16. Example

View license
[Test]
        public void Boost_ReturnsDisjunctionQuery()
        {
            var query = new DisjunctionQuery().Boost(2.2);

            Assert.IsInstanceOf<DisjunctionQuery> (query);
        }

17. Example

View license
[Test]
        public void Boost_Returns_NumericRangeQuery()
        {
            var query = new NumericRangeQuery().Boost(2.2);

            Assert.IsInstanceOf<NumericRangeQuery> (query);
        }

18. Example

View license
[Test]
        public void JsonSettings_With_Null_ContractResolver_Uses_JsonConvert_Default_ContractResolver_If_Available()
        {
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            var deserializationSettings = new JsonSerializerSettings
            {
                ContractResolver = null
            };
            var serializationSettings = new JsonSerializerSettings
            {
                ContractResolver = null
            };

            var serializer = new DefaultSerializer(deserializationSettings, serializationSettings);

            Assert.IsInstanceOf<CamelCasePropertyNamesContractResolver>(serializer.DeserializationSettings.ContractResolver);
            Assert.IsInstanceOf<CamelCasePropertyNamesContractResolver>(serializer.SerializerSettings.ContractResolver);
        }

19. Example

View license
[Test]
        public void Boost_ReturnsPrefixQuery()
        {
            var query = new PrefixQuery("prefix").Boost(2.2);

            Assert.IsInstanceOf<PrefixQuery> (query);
        }

20. Example

View license
[Test]
        public void SetException_KeyNotFound_Sets_DocumentDoesNotExistException()
        {
            var result = new OperationResult
            {
                Status = ResponseStatus.KeyNotFound
            };

            result.SetException();
            Assert.IsInstanceOf<DocumentDoesNotExistException>(result.Exception);
        }

21. Example

View license
[Test]
        public void Boost_ReturnsStringQuery()
        {
            var query = new QueryStringQuery("description:water and some other stuff").Boost(2.2);

            Assert.IsInstanceOf<QueryStringQuery> (query);
        }

22. Example

Project: csunits
Source File: MeasureTripletTests.cs
View license
[Test]
        public void IMeasureXAccessor_CheckReturnType_ShouldBeIMeasure()
        {
            var expected = typeof(IMeasure<Time>);
            IMeasureTriplet<Time, Power, ElectricPotential> triplet = _instance;
            var actual = triplet.X;
            Assert.IsInstanceOf(expected, actual);
        }

23. Example

Project: csunits
Source File: IMeasureTests.cs
View license
[Test]
        public void UnitGetter_ValidateReturnType_SupportsNonGeneric()
        {
            var expected = typeof (IUnit);
            var actual = _instance.Unit;
            Assert.IsInstanceOf(expected, actual);
        }

24. Example

Project: csunits
Source File: QuantityAdapterTests.cs
View license
[Test]
        public void QuantityGetter_CompareWithQuantityUsedInConstructor_AreEqual()
        {
            var actual = _instance.Quantity;
            Assert.IsInstanceOf<Force>(actual);
        }

25. Example

Project: csunits
Source File: UnitTests.cs
View license
[Test]
        public void Quantity_OfIUnitDefinedAsMassUnit_IsMass()
        {
            IUnit unit = Mass.HectoGram;
            Assert.IsInstanceOf(typeof(Mass), unit.Quantity);
        }

26. Example

Project: csunits
Source File: UnitTests.cs
View license
[Test]
        public void Quantity_OfLengthUnit_IsLength()
        {
            Assert.IsInstanceOf(typeof(Length), Length.PicoMeter.Quantity);
        }

27. Example

Project: CSMSL
Source File: MassTestFixture.cs
View license
[Test]
        public void MassIsIMass()
        {
            Mass m1 = new Mass(524.342);

            Assert.IsInstanceOf<IMass>(m1);
        }

28. Example

Project: OrigoDB
Source File: StoreTests.cs
View license
[Test]
        public void Can_load_from_journal_with_ModelCreatedEntry()
        {
            JournalAppender.Create(0, _commandStore).AppendModelCreated(typeof(ImmutableModel));
            Model model = new ModelLoader(_config, _commandStore).LoadModel();
            Assert.IsInstanceOf<ImmutableModel>(model);
        }

29. Example

Project: OrigoDB
Source File: EngineConfigurationTest.cs
View license
[Test]
        public void PacketingFormatterIsReturnedWhenPaketOptionsArePresent()
        {
            var config = new EngineConfiguration();
            config.PacketOptions = PacketOptions.Checksum;
            config.SetFormatterFactory((c,f) => new BinaryFormatter());
            var actual = config.CreateFormatter(FormatterUsage.Journal);
            Assert.IsInstanceOf<PacketingFormatter>(actual);
        }

30. Example

Project: OrigoDB
Source File: EngineTest.cs
View license
[Test]
        public void CanGetModelReference()
        {
            var config = new EngineConfiguration().ForIsolatedTest();
            var engine = Engine.Create<TestModel>(config);
            engine.Execute(new TestCommandWithoutResult());
            var model = engine.GetModel();
            Assert.IsInstanceOf(typeof(TestModel), model);
        }

31. Example

Project: OrigoDB
Source File: RolloverTests.cs
View license
[Test]
        public void CompositeIsDefault()
        {
            var config = new EngineConfiguration();
            var strategy = config.CreateRolloverStrategy();
            Assert.IsInstanceOf<CompositeRolloverStrategy>(strategy);
        }

32. Example

View license
[Test]
        public void PetaPocoDataContext_Constructor_Initialises_Mapper_Property()
        {
            //Arrange

            //Act
            var context = new PetaPocoDataContext(connectionStringName);

            //Assert
            Assert.IsInstanceOf<IMapper>(Util.GetPrivateMember<PetaPocoDataContext, IMapper>(context, "_mapper"));
            Assert.IsInstanceOf<PetaPocoMapper>(Util.GetPrivateMember<PetaPocoDataContext, PetaPocoMapper>(context, "_mapper"));
        }

33. Example

View license
[Test]
        [TestCase(0, 5)]
        [TestCase(0, 6)]
        [TestCase(2, 4)]
        [TestCase(4, 4)]
        public void PagingExtensions_ToPagedList_Returns_PagedList_From_Enumerable(int index, int pageSize)
        {
            //Arrange
            List<int> enumerable = Util.CreateIntegerList(Constants.PAGE_TotalCount);

            //Act
            IPagedList<int> pagedList = enumerable.ToPagedList(index, pageSize);

            //Assert
            Assert.IsInstanceOf<IPagedList<int>>(pagedList);
        }

34. Example

Project: Dnn.Platform
Source File: ResultAssert.cs
View license
public static void IsEmpty(ActionResult result)
        {
            Assert.IsInstanceOf<EmptyResult>(result);
        }

35. Example

View license
[Test]
        public void PetaPocoDataContext_GetRepository_Returns_Repository()
        {
            //Arrange
            var context = new PetaPocoDataContext(connectionStringName);

            //Act
            var repo = context.GetRepository<Dog>();

            //Assert
            Assert.IsInstanceOf<IRepository<Dog>>(repo);
            Assert.IsInstanceOf<PetaPocoRepository<Dog>>(repo);
        }

36. Example

View license
[Test]
        public void PetaPocoDataContext_GetRepository_Sets_Repository_Database_Property()
        {
            //Arrange
            var context = new PetaPocoDataContext(connectionStringName);

            //Act
            var repo = (PetaPocoRepository<Dog>)context.GetRepository<Dog>();

            //Assert
            Assert.IsInstanceOf<Database>(Util.GetPrivateMember<PetaPocoRepository<Dog>, Database>(repo, "_database"));
        }

37. Example

Project: Dnn.Platform
Source File: ResultAssert.cs
View license
public static void IsUnauthorized(ActionResult result)
        {
            Assert.IsInstanceOf<HttpUnauthorizedResult>(result);
        }

38. Example

Project: Dnn.Platform
Source File: DataProviderTests.cs
View license
[Test]
        public void DataProvider_Instance_Method_Returns_Instance()
        {
            //Arrange
            ComponentFactory.Container = new SimpleContainer();
            ComponentFactory.RegisterComponentInstance<DataProvider>(new FakeDataProvider(new Dictionary<string, string>()));

            //Act
            var provider = DataProvider.Instance();

            //Assert
            Assert.IsInstanceOf<DataProvider>(provider);
            Assert.IsInstanceOf<FakeDataProvider>(provider);
        }

39. Example

View license
[Test]
        public void PetaPocoDataContext_Constructor_Initialises_Database_Property()
        {
            //Arrange

            //Act
            var context = new PetaPocoDataContext(connectionStringName);

            //Assert
            Assert.IsInstanceOf<Database>(Util.GetPrivateMember<PetaPocoDataContext, Database>(context, "_database"));
        }

40. Example

Project: Dnn.Platform
Source File: FluentMapperTests.cs
View license
[Test]
        public void FluentMapper_GetTableInfo_Returns_TableInfo()
        {
            //Arrange
            var mapper = new FluentMapper<Dog>(Constants.TABLENAME_Prefix);

            //Act
            var ti = mapper.GetTableInfo(typeof(Dog));

            //Assert
            Assert.IsInstanceOf<TableInfo>(ti);
        }

41. Example

View license
[Test]
        public void PagingExtensions_InPagesOf_Returns_PageSelector()
        {
            //Arrange
            IQueryable<int> queryable = Util.CreateIntegerList(Constants.PAGE_TotalCount).AsQueryable();

            //Act
            PageSelector<int> pageSelector = queryable.InPagesOf(Constants.PAGE_RecordCount);

            //Assert
            Assert.IsInstanceOf<PageSelector<int>>(pageSelector);
        }

42. Example

Project: Dnn.Platform
Source File: DataContextTests.cs
View license
[Test]
        public void DataContext_Instance_Method_Returns_PetaPocoDataContext()
        {
            //Arrange

            //Act
            var context = DataContext.Instance();

            //Assert
            Assert.IsInstanceOf<IDataContext>(context);
            Assert.IsInstanceOf<PetaPocoDataContext>(context);
        }

43. Example

View license
[Test]
        public void PetaPocoDataContext_GetRepository_Uses_PetaPocoMapper_If_No_FluentMapper()
        {
            //Arrange
            var context = new PetaPocoDataContext(connectionStringName);

            //Act
            var repo = (PetaPocoRepository<Dog>)context.GetRepository<Dog>();

            //Assert
            Assert.IsInstanceOf<IMapper>(Util.GetPrivateMember<PetaPocoRepository<Dog>, IMapper>(repo, "_mapper"));
            Assert.IsInstanceOf<PetaPocoMapper>(Util.GetPrivateMember<PetaPocoRepository<Dog>, IMapper>(repo, "_mapper"));
        }

44. Example

View license
[Test]
        [TestCase(0, 5)]
        [TestCase(0, 6)]
        [TestCase(2, 4)]
        [TestCase(4, 4)]
        public void PagingExtensions_ToPagedList_Returns_PagedList_From_Queryable(int index, int pageSize)
        {
            //Arrange
            IQueryable<int> queryable = Util.CreateIntegerList(Constants.PAGE_TotalCount).AsQueryable();

            //Act
            IPagedList<int> pagedList = queryable.ToPagedList(index, pageSize);

            //Assert
            Assert.IsInstanceOf<IPagedList<int>>(pagedList);
        }

45. Example

Project: Dnn.Platform
Source File: PetaPocoMapperTests.cs
View license
[Test]
        public void PetaPocoMapper_GetTableInfo_Returns_TableInfo()
        {
            //Arrange
            var mapper = new PetaPocoMapper(Constants.TABLENAME_Prefix);

            //Act
            var ti = mapper.GetTableInfo(typeof(Dog));

            //Assert
            Assert.IsInstanceOf<TableInfo>(ti);
        }

46. Example

View license
[Test]
        public void PetaPocoDataContext_GetRepository_Uses_FluentMapper_If_FluentMapper_Defined()
        {
            //Arrange
            var context = new PetaPocoDataContext(connectionStringName);
            context.AddFluentMapper<Dog>();

            //Act
            var repo = (PetaPocoRepository<Dog>)context.GetRepository<Dog>();

            //Assert
            Assert.IsInstanceOf<IMapper>(Util.GetPrivateMember<PetaPocoRepository<Dog>, IMapper>(repo, "_mapper"));
            Assert.IsInstanceOf<FluentMapper<Dog>>(Util.GetPrivateMember<PetaPocoRepository<Dog>, IMapper>(repo, "_mapper"));
        }

47. Example

Project: DustedCodes
Source File: RssFeedResultTests.cs
View license
[Test]
        public void Class_Inherits_From_FeedResult()
        {
            var feed = Builder<SyndicationFeed>.CreateNew().Build();

            var result = new RssFeedResult(feed);

            Assert.IsInstanceOf<FeedResult>(result);
        }

48. Example

Project: DustedCodes
Source File: AtomFeedResultTests.cs
View license
[Test]
        public void Class_Inherits_From_FeedResult()
        {
            var feed = Builder<SyndicationFeed>.CreateNew().Build();

            var result = new AtomFeedResult(feed);

            Assert.IsInstanceOf<FeedResult>(result);
        }

49. Example

View license
public static void ShouldBe<T>(this object actual)
        {
            Assert.IsInstanceOf<T>(actual);
        }

50. Example

View license
public static void ShouldBe<T>(this object actual)
        {
            Assert.IsInstanceOf<T>(actual);
        }