NUnit.Framework.Assert.Contains(object, System.Collections.ICollection)

Here are the examples of the csharp api class NUnit.Framework.Assert.Contains(object, System.Collections.ICollection) 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
[Test]
		public void ArraySucceeds()
		{
			Assert.Contains( "abc", testArray );
			Assert.Contains( 123, testArray );
			Assert.Contains( "xyz", testArray );
		}

2. Example

View license
[Test]
		public void DifferentTypesMayBeEqual()
		{
			// TODO: Better message for this case
			expectedMessage =
				"  Expected: collection containing 123.0d" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;
			Assert.Contains( 123.0, new ArrayList( testArray ) );
		}

3. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void ArrayListFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;
			Assert.Contains( "def", new ArrayList( testArray ) );
		}

4. Example

View license
[Test,ExpectedException(typeof(ArgumentException))]
		public void NullArrayIsError()
		{
			Assert.Contains( "def", null );
		}

5. Example

View license
[Test]
		public void ArrayListSucceeds()
		{
			ArrayList list = new ArrayList( testArray );

			Assert.Contains( "abc", list );
			Assert.Contains( 123, list );
			Assert.Contains( "xyz", list );
		}

6. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void EmptyArrayFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  <empty>" + Environment.NewLine;	
			Assert.Contains( "def", new object[0] );
		}

7. Example

View license
[Test]
		public void CategoryOnTestCase()
		{
			Test test1 = (Test)fixture.Tests[0];
			Assert.Contains( "Long", test1.Categories );
		}

8. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void ArrayListFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;
			Assert.Contains( "def", new ArrayList( testArray ) );
		}

9. Example

View license
[Test]
		public void CanDeriveFromCategoryAttribute()
		{
			Test test2 = (Test)fixture.Tests[1];
			Assert.Contains( "Critical", test2.Categories );
		}

10. Example

View license
[Test]
		public void CategoryOnFixture()
		{
			Assert.Contains( "DataBase", fixture.Categories );
		}

11. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void ArrayFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;	
			Assert.Contains("def", testArray);
		}

12. Example

View license
[Test]
		public void CategoryOnFixture()
		{
			Assert.Contains( "DataBase", fixture.Categories );
		}

13. Example

View license
[Test,ExpectedException(typeof(ArgumentException))]
		public void NullArrayIsError()
		{
			Assert.Contains( "def", null );
		}

14. Example

View license
[Test]
		public void CanDeriveFromCategoryAttribute()
		{
			Test test2 = (Test)fixture.Tests[1];
			Assert.Contains( "Critical", test2.Categories );
		}

15. Example

View license
[Test,ExpectedException(typeof(ArgumentException))]
		public void NullArrayIsError()
		{
			Assert.Contains( "def", null );
		}

16. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void ArrayFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;	
			Assert.Contains("def", testArray);
		}

17. Example

View license
[Test]
		public void DifferentTypesMayBeEqual()
		{
			// TODO: Better message for this case
			expectedMessage =
				"  Expected: collection containing 123.0d" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;
			Assert.Contains( 123.0, new ArrayList( testArray ) );
		}

18. Example

View license
[Test]
		public void CategoryOnTestCase()
		{
			Test test1 = (Test)fixture.Tests[0];
			Assert.Contains( "Long", test1.Categories );
		}

19. Example

View license
[Test]
		public void CategoryOnFixture()
		{
			Assert.Contains( "DataBase", fixture.Categories );
		}

20. Example

View license
[Test]
		public void DifferentTypesMayBeEqual()
		{
			// TODO: Better message for this case
			expectedMessage =
				"  Expected: collection containing 123.0d" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;
			Assert.Contains( 123.0, new ArrayList( testArray ) );
		}

21. Example

View license
[Test]
		public void DerivedCategoryMayBeInherited()
		{
			Assert.Contains("MyCategory", fixture.Categories);
		}

22. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void ArrayFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;	
			Assert.Contains("def", testArray);
		}

23. Example

View license
[Test]
		public void ArraySucceeds()
		{
			Assert.Contains( "abc", testArray );
			Assert.Contains( 123, testArray );
			Assert.Contains( "xyz", testArray );
		}

24. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void EmptyArrayFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  <empty>" + Environment.NewLine;	
			Assert.Contains( "def", new object[0] );
		}

25. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void EmptyArrayFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  <empty>" + Environment.NewLine;	
			Assert.Contains( "def", new object[0] );
		}

26. Example

View license
[Test]
		public void CanDeriveFromCategoryAttribute()
		{
			Test test2 = (Test)fixture.Tests[1];
			Assert.Contains( "Critical", test2.Categories );
		}

27. Example

View license
[Test]
		public void DerivedCategoryMayBeInherited()
		{
			Assert.Contains("MyCategory", fixture.Categories);
		}

28. Example

View license
[Test]
		public void DerivedCategoryMayBeInherited()
		{
			Assert.Contains("MyCategory", fixture.Categories);
		}

29. Example

View license
[Test]
		public void ArrayListSucceeds()
		{
			ArrayList list = new ArrayList( testArray );

			Assert.Contains( "abc", list );
			Assert.Contains( 123, list );
			Assert.Contains( "xyz", list );
		}

30. Example

View license
[Test]
		public void ArrayListSucceeds()
		{
			ArrayList list = new ArrayList( testArray );

			Assert.Contains( "abc", list );
			Assert.Contains( 123, list );
			Assert.Contains( "xyz", list );
		}

31. Example

View license
[Test]
		public void CategoryOnTestCase()
		{
			Test test1 = (Test)fixture.Tests[0];
			Assert.Contains( "Long", test1.Categories );
		}

32. Example

View license
[Test]
		public void ArraySucceeds()
		{
			Assert.Contains( "abc", testArray );
			Assert.Contains( 123, testArray );
			Assert.Contains( "xyz", testArray );
		}

33. Example

View license
[Test,ExpectedException(typeof(AssertionException))]
		public void ArrayListFails()
		{
			expectedMessage =
				"  Expected: collection containing \"def\"" + Environment.NewLine + 
				"  But was:  < \"abc\", 123, \"xyz\" >" + Environment.NewLine;
			Assert.Contains( "def", new ArrayList( testArray ) );
		}

34. Example

Project: CSMSL
Source File: ProteaseTestFixture.cs
View license
[Test]
        public void MultipleProteaseDigestion()
        {
            List<IProtease> proteases = new List<IProtease> { Protease.GetProtease("Trypsin"), Protease.GetProtease("GluC") };

            List<Peptide> peptides = _proteinA.Digest(proteases, maxMissedCleavages: 1, maxLength: 5).ToList();
            Assert.Contains(new Peptide("NWSK"), peptides);
            Assert.Contains(new Peptide("ENWSK"), peptides);
        }

35. Example

Project: CSMSL
Source File: ProteaseTestFixture.cs
View license
[Test]
        public void TrypsinDigestion()
        {
            List<Peptide> peptides = _proteinA.Digest(Protease.GetProtease("Trypsin")).ToList();
            Peptide pepA = new Peptide("TTGSSSSSSSK");

            Assert.Contains(pepA, peptides);
        }

36. Example

View license
[Test]
        public void ChemicalFormulaGeneratorContainsFormula()
        {
            ChemicalFormulaGenerator generator = new ChemicalFormulaGenerator(new ChemicalFormula("H2O"));

            List<ChemicalFormula> formulas = generator.AllFormulas().ToList();
            ChemicalFormula ho = new ChemicalFormula("HO");

            Assert.Contains(ho, formulas);
        }

37. Example

Project: CSMSL
Source File: ProteaseTestFixture.cs
View license
[Test]
        public void TryspinNoProlineRuleDigestion()
        {
            List<Peptide> peptides = _proteinA.Digest(Protease.GetProtease("Trypsin No Proline Rule")).ToList();

            Assert.Contains(new Peptide("INLFR"), peptides);
        }

38. Example

Project: CSMSL
Source File: ProteaseTestFixture.cs
View license
[Test]
        public void InitiatorMethonineCleaved()
        {
            List<Peptide> peptides = _proteinA.Digest(Protease.GetProtease("LysC"), 1, initiatorMethonine: true).ToList();
            Assert.Contains(new Peptide("MRGFK"), peptides);
            Assert.Contains(new Peptide("MMRGFK"), peptides);
        }

39. Example

Project: CSMSL
Source File: ProteaseTestFixture.cs
View license
[Test]
        public void NoEnzymeDigestion()
        {
            List<Peptide> peptides = _proteinA.Digest(Protease.GetProtease("None"), maxMissedCleavages: 8, minLength: 5).ToList();
            Assert.Contains(new Peptide("SLYHPQ"), peptides);
        }

40. Example

View license
[Test]
        public void RegisterComponentInstance_Must_Register_In_ComponentsList()
        {
            var container = new SimpleContainer();
            ComponentFactory.Container = container;

            container.RegisterComponentInstance("test", typeof(IList<string>), new List<string>());

            Assert.Contains("test", ComponentFactory.GetComponents<IList<string>>().Keys);
        }

41. Example

Project: Rentitas
Source File: GroupTests.cs
View license
[Test]
        public void cached_group_contains_newly_created_entity()
        {
            var g = pool.GetGroup(matcherAB);
            eA.Add<TestComponentB>();
            Assert.Contains(eA, g.GetEntities());
        }

42. Example

View license
[Test]
    public void CheckErrors()
    {
        Assert.Contains("Method 'System.Void AbstractClassWithAttributeOnMethod::Method()' is abstract but has a [TimeAttribute]. Remove this attribute.", assemblyWeaver.Errors);
        Assert.Contains("Method 'System.Void MyInterface::MyMethod()' is abstract but has a [TimeAttribute]. Remove this attribute.", assemblyWeaver.Errors);
    }

43. Example

Project: AssertMessage
Source File: NunitTests.cs
View license
public void Contains_should_have_message()
        {
            var expected = new object();
            var collection = new[] { new Object(), new Object() };

            Assert.Contains(expected, collection);
        }

44. Example

View license
[Test]
    public void Default()
    {
        var moduleWeaver = new ModuleWeaver();
        moduleWeaver.ResolveEventInvokerName();
        Assert.Contains("OnPropertyChanged", moduleWeaver.EventInvokerNames);
        Assert.Contains("SetProperty", moduleWeaver.EventInvokerNames);
        Assert.Contains("NotifyOfPropertyChange", moduleWeaver.EventInvokerNames);
        Assert.Contains("RaisePropertyChanged", moduleWeaver.EventInvokerNames);
        Assert.Contains("NotifyPropertyChanged", moduleWeaver.EventInvokerNames);
        Assert.Contains("NotifyChanged", moduleWeaver.EventInvokerNames);
        Assert.Contains("raisePropertyChanged", moduleWeaver.EventInvokerNames);
    }

45. Example

View license
[Test]
    public void MultipleNotifications()
    {
        var propertyDefinition = DefinitionFinder.FindProperty(() => new Multiple().Property);

        var moduleWeaver = new ModuleWeaver();
        var propertyNames = moduleWeaver.GetAlreadyNotifies(propertyDefinition).ToList();
        Assert.Contains("Property1",propertyNames);
        Assert.Contains("Property2",propertyNames);
    }

46. Example

View license
[Test]
    public void MultipleNotifications()
    {
        var propertyDefinition = DefinitionFinder.FindProperty(() => new Multiple().Property);

        var propertyNames = propertyDefinition.GetAlreadyNotifies("OnPropertyChanging").ToList();
        Assert.Contains("Property1", propertyNames);
        Assert.Contains("Property2", propertyNames);
    }

47. Example

Project: Obsolete
Source File: IntegrationTests.cs
View license
[Test]
    public void Warnings()
    {
        Assert.Contains("The member `ClassWithObsoleteAttribute` has an ObsoleteAttribute. Consider replacing it with an ObsoleteExAttribute.", warnings);
    }

48. Example

Project: Obsolete
Source File: IntegrationTests.cs
View license
[Test]
    public void Errors()
    {
        Assert.Contains("ObsoleteExAttribute is not valid on property gets or sets. Member: `System.Void ClassWithObsoleteOnGetSet::set_PropertyToMark(System.String)`.", errors);
        Assert.Contains("ObsoleteExAttribute is not valid on property gets or sets. Member: `System.String ClassWithObsoleteOnGetSet::get_PropertyToMark()`.", errors);
    }

49. Example

Project: gauge-csharp
Source File: AssemblyLoaderTests.cs
View license
[Test]
        public void ShouldGetAssemblyReferencingGaugeLib()
        {
            Assert.Contains(_mockAssembly.Object, _assemblyLoader.AssembliesReferencingGaugeLib);
        }

50. Example

Project: gauge-csharp
Source File: AssemblyLoaderTests.cs
View license
[Test]
        public void ShouldGetClassInstanceManagerTypes()
        {
            Assert.Contains(_mockInstanceManagerType.Object, _assemblyLoader.ClassInstanceManagerTypes);
        }