Xunit.Assert.Equal(string, string, bool, bool, bool)

Here are the examples of the csharp api Xunit.Assert.Equal(string, string, bool, bool, bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6280 Examples 7

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #27
      public void ApplyFiltering_LessThanBetweenTwoStrings()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("name < v").ToList();

         var expected = _fakeRepository.Where(q => string.Compare(q.Name, "v", StringComparison.Ordinal) < 0).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #33
      public void ApplyFiltering_WithSpaces()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("name =ali reza").ToList();
         var expected = _fakeRepository.Where(q => q.Name == "ali reza" ).ToList();
         
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_CustomConvertor()
      {
         const string gq = "name=liam";
         var gm = new GridifyMapper<TestClreplaced>()
            .GenerateMappings()
            .AddMap("name", q => q.Name, q => q.ToUpper()); // using client side Custom convertor

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq, gm)
            .ToList();

         var expected = _fakeRepository.Where(q => q.Name == "LIAM").ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_CaseInsensitiveSearch() //issue #21
      {
         var gq = new GridifyQuery { Filter = "name=BOB/i " };

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();

         var expected = _fakeRepository.Where(q => q.Name!.ToLower() == "BOB".ToLower()).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_NotStartsWith()
      {
         const string gq = "name!^A";

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();

         var expected = _fakeRepository.Where(q => !q.Name!.StartsWith("A")).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_DuplicatefieldName()
      {
         const string gq = "name=John|name=Sara";
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();
         var expected = _fakeRepository.Where(q => (q.Name == "John") | (q.Name == "Sara")).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #25
      public void ApplyFiltering_Equal_ProcessingNullOrDefaultValue()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("tag=").ToList();
         var expected = _fakeRepository.Where(q => string.IsNullOrEmpty(q.Tag)).ToList();
         var expected2 = _fakeRepository.Where(q => q.Tag is null or "").ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected2.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.Equal(expected2, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GetActivatedFeaturesTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void FindAllActivationsOfAllFeatures()
        {
            // No Found callback b/c we process final list

            // Act
            var featureList = repository.GetActivatedFeatures ();


            // replacedert
            int faultyWeb = featureList.Where(f => f.Id == TestContent.TestFeatures.FaultyWeb.Id).Count();
            replacedert.Equal(TestContent.SharePointContainers.Farm.FaultyWebFeatureActivatedTotal, faultyWeb);

            int faultySiCo = featureList.Where(f => f.Id == TestContent.TestFeatures.FaultySite.Id).Count();
            replacedert.Equal(TestContent.SharePointContainers.Farm.FaultySiCoFeatureActivatedTotal, faultySiCo);

            // faulty web app feature gets removed on retract ...
            // int faultyWebApp = featureList[TestContent.TestFeatures.FaultyWebApp].Count();
            // replacedert.Equal(TestContent.SharePointContainers.Farm.FaultyWebAppFeatureActivatedTotal, faultyWebApp);

            // faulty farm feature gets removed on retract ...
            //int faultyFarm = featureList[TestContent.TestFeatures.FaultyFarm].Count();
            //replacedert.Equal(TestContent.SharePointContainers.Farm.FaultyFarmFeatureActivated, faultyFarm);

            int healthyWeb = featureList.Where(f => f.Id == TestContent.TestFeatures.HealthyWeb.Id).Count();
            replacedert.Equal(TestContent.SharePointContainers.Farm.HealthyWebFeatureActivatedTotal, healthyWeb);

            int healthySiCo = featureList.Where(f => f.Id == TestContent.TestFeatures.HealthySite.Id).Count();
            replacedert.Equal(TestContent.SharePointContainers.Farm.HealthySiCoFeatureActivatedTotal, healthySiCo);

            int healthyWebApp = featureList.Where(f => f.Id == TestContent.TestFeatures.HealthyWebApp.Id).Count();
            replacedert.Equal(TestContent.SharePointContainers.Farm.HealthyWebAppFeatureActivatedTotal, healthyWebApp);

            int healthyFarm = featureList.Where(f => f.Id == TestContent.TestFeatures.HealthyFarm.Id).Count();
            replacedert.Equal(TestContent.SharePointContainers.Farm.HealthyFarmFeatureActivated, healthyFarm);
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyOrdering_OrderBy_Ascending()
      {
         var gq = new GridifyQuery { OrderBy = "name" };
         var actual = _fakeRepository.AsQueryable()
            .ApplyOrdering(gq)
            .ToList();
         var expected = _fakeRepository.OrderBy(q => q.Name).ToList();
         replacedert.Equal(expected, actual);
      }

19 View Source File : RendererTest.cs
License : MIT License
Project Creator : adamped

[Fact]
		public void Test_Renderer()
		{
			var renderer = new TextViewCustomRenderer();

			renderer.SetElement(new Xamarin.Forms.Entry());

			replacedert.Equal(renderer.Control.PaddingLeft, 10);
		}

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_UsingChildClreplacedProperty()
      {
         var gq = new GridifyQuery { Filter = "Child_Name=Bob" };
         var gm = new GridifyMapper<TestClreplaced>()
            .GenerateMappings()
            .AddMap("Child_name", q => q.ChildClreplaced!.Name);

         var actual = _fakeRepository.AsQueryable()
            .Where(q => q.ChildClreplaced != null)
            .ApplyFiltering(gq, gm)
            .ToList();

         var expected = _fakeRepository.Where(q => q.ChildClreplaced is { Name: "Bob" }).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_NotEndsWith()
      {
         const string gq = "name !$ i";

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();

         var expected = _fakeRepository.Where(q => !q.Name!.EndsWith("i")).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_NullHandlingUsingMapper()
      {
         // create custom mapper
         var gm = new GridifyMapper<TestClreplaced>(q => q.AllowNullSearch = true) // default is true
            .GenerateMappings();

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering("MyDateTime=null", gm)
            .ToList();

         var expected = _fakeRepository.Where(q => q.MyDateTime == null).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_CaseInsensitiveOperatorAtTheBeginningOfValue_ShouldIgnore()
      {
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(@"name=\/icase")
            .ToList();

         var expected = _fakeRepository.Where(q => q.Name == "/icase").ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.False(actual.Any());
      }

19 View Source File : FeatureParentFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetFetaureParentFromFarm()
        {
            // Arrange
            var parentScope = SPFeatureScope.Farm;
            // var parentUrl = TestContent.SharePointContainers.WebApplication.Url;

            
                SPWebService parent = SPWebService.ContentService;


                var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthyFarm.Id];
                // var testFeatureFaulty = parent.Features[TestContent.TestFeatures.FaultyFarm.Id];

                // Act
                var parentRetrievedWithScope = FeatureParent.GetFeatureParent(testFeatureHealthy, parentScope);
                var parentRetrievedNoScope = FeatureParent.GetFeatureParent(testFeatureHealthy);


                // replacedert
                replacedert.Equal("Farm", parentRetrievedWithScope.DisplayName);
                replacedert.Equal(parent.Id, parentRetrievedWithScope.Id);
                replacedert.Equal("Farm", parentRetrievedWithScope.Url);
                replacedert.Equal(parentScope, parentRetrievedWithScope.Scope);

                replacedert.Equal("Farm", parentRetrievedNoScope.DisplayName);
                replacedert.Equal(parent.Id, parentRetrievedNoScope.Id);
                replacedert.Equal("Farm", parentRetrievedNoScope.Url);
                replacedert.Equal(parentScope, parentRetrievedNoScope.Scope );
            }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #27
      public void ApplyFiltering_GreaterThanOrEqualBetweenTwoStrings()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("name >= c").ToList();
         var expected = _fakeRepository.Where(q => string.Compare(q.Name, "c", StringComparison.Ordinal) >= 0).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_SingleGuidField()
      {
         var guidString = "e2cec5dd-208d-4bb5-a852-50008f8ba366";
         var guid = Guid.Parse(guidString);
         var gq = new GridifyQuery { Filter = "myGuid=" + guidString };
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();
         var expected = _fakeRepository.Where(q => q.MyGuid == guid).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #25
      public void ApplyFiltering_Equal_ProcessingNullOrDefaultValueNonStringTypes()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("myGuid=").ToList();
         var expected = _fakeRepository.Where(q => q.MyGuid == default).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : ActivatedFeatureFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetActivatedFeatureFromFarm()
        {
            // Arrange
            var parentScope = SPFeatureScope.Farm;
            // var parentUrl = TestContent.SharePointContainers.WebApplication.Url;


            SPWebService farm = SPWebService.ContentService;

            var parent = farm;

            // Act

            var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthyFarm.Id];
            // web app features cannot easily be reproduced in faulty state
            // var testFeatureFaulty = parent.Features[TestContent.TestFeatures.FaultyFarm.Id];

            var featureParent = FeatureParent.GetFeatureParent(parent);


            var sharePointFeatureHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy);
            var sharePointFeatureRetrievedWithParentHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy, featureParent);

            // replacedert
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Id, sharePointFeatureHealthy.Id);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Name, sharePointFeatureHealthy.Name);
            replacedert.Equal(featureParent.Url, sharePointFeatureHealthy.Parent.Url);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Version, sharePointFeatureHealthy.Version);
            replacedert.Equal(parentScope, sharePointFeatureHealthy.Scope);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Faulty, sharePointFeatureHealthy.Faulty);

            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Id, sharePointFeatureRetrievedWithParentHealthy.Id);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Name, sharePointFeatureRetrievedWithParentHealthy.Name);
            replacedert.Equal(featureParent.Url, sharePointFeatureRetrievedWithParentHealthy.Parent.Url);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Version, sharePointFeatureRetrievedWithParentHealthy.Version);
            replacedert.Equal(parentScope, sharePointFeatureRetrievedWithParentHealthy.Scope);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Faulty, sharePointFeatureRetrievedWithParentHealthy.Faulty);
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #34
      public void ApplyFiltering_UnmappedFields_ShouldSkipWhenIgnored()
      {
         var gm = new GridifyMapper<TestClreplaced>(configuration => configuration.IgnoreNotMappedFields = true)
            .AddMap("Id", q => q.Id);
      
         // name=*a filter should be ignored
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("name=*a, id>15", gm).ToList();
         var expected = _fakeRepository.Where(q => q.Id > 15).ToList();
      
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyEverything_EmptyGridifyQuery()
      {
         var gq = new GridifyQuery();

         var actual = _fakeRepository.AsQueryable()
            .ApplyFilteringOrderingPaging(gq)
            .ToList();

         var expected = _fakeRepository.Skip(0).Take(GridifyExtensions.DefaultPageSize).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_StartsWithOnNotStringsShouldNotThrowError()
      {
         const string gq = "Id^2";

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();

         var expected = _fakeRepository.Where(q => q.Id.ToString().StartsWith("2")).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : FeatureParentFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetFeatureParentFromWeb()
        {
            // Arrange
            var parentScope = SPFeatureScope.Web;
            var parentUrl = TestContent.SharePointContainers.SiCoActivated.Url;

            using (SPSite site = new SPSite(parentUrl))
            {
                using (SPWeb parent = site.OpenWeb())
                {

                    var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthyWeb.Id];
                    var testFeatureFaulty = parent.Features[TestContent.TestFeatures.FaultyWeb.Id];

                    // Act
                    var parentHealthy = FeatureParent.GetFeatureParent(testFeatureHealthy);
                    var parentFaulty = FeatureParent.GetFeatureParent(testFeatureFaulty);
                    var parentRetrievedWithScopeHealthy = FeatureParent.GetFeatureParent(testFeatureHealthy, parentScope);
                    var parentRetrievedWithScopeFaulty = FeatureParent.GetFeatureParent(testFeatureFaulty, parentScope);

                    // replacedert
                    replacedert.Equal(parent.replacedle, parentHealthy.DisplayName);
                    replacedert.Equal(parent.ID, parentHealthy.Id);
                    replacedert.Equal(parentUrl, parentHealthy.Url);
                    replacedert.Equal(parentScope, parentHealthy.Scope);

                    replacedert.Equal(parent.replacedle, parentFaulty.DisplayName);
                    replacedert.Equal(parent.ID, parentFaulty.Id);
                    replacedert.Equal(parentUrl, parentFaulty.Url);
                    replacedert.Equal(parentScope, parentFaulty.Scope);

                    replacedert.Equal(parent.replacedle, parentRetrievedWithScopeHealthy.DisplayName);
                    replacedert.Equal(parent.ID, parentRetrievedWithScopeHealthy.Id);
                    replacedert.Equal(parentUrl, parentRetrievedWithScopeHealthy.Url);
                    replacedert.Equal(parentScope, parentRetrievedWithScopeHealthy.Scope);

                    replacedert.Equal(parent.replacedle, parentRetrievedWithScopeFaulty.DisplayName);
                    replacedert.Equal(parent.ID, parentRetrievedWithScopeFaulty.Id);
                    replacedert.Equal(parentUrl, parentRetrievedWithScopeFaulty.Url);
                    replacedert.Equal(parentScope, parentRetrievedWithScopeFaulty.Scope);
                }
            }
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_EndsWith()
      {
         const string gq = "name $ li";

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();

         var expected = _fakeRepository.Where(q => q.Name!.EndsWith("li")).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyEntityFrameworkTests.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_GreaterThanBetweenTwoStringsInEF()
      {
         GridifyGlobalConfiguration.EnableEnreplacedyFrameworkCompatibilityLayer();

         var actual = _dbContext.Users.ApplyFiltering("name > h").ToList();
         var expected = _dbContext.Users.Where(q => string.Compare(q.Name, "h") > 0).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_NestedParenthesisWithSpace()
      {
         // we shouldn't add spaces for values 
         var gq = new GridifyQuery { Filter = " ( name =*J| ( name =*S , Id <5 ) )" };
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();
         var expected = _fakeRepository.Where(q => q.Name!.Contains("J") || q.Name.Contains("S") && q.Id < 5).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_MultipleCondition()
      {
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering("name=Jack|name=Rose|id>=7")
            .ToList();
         var expected = _fakeRepository.Where(q => q.Name == "Jack" || q.Name == "Rose" || q.Id >= 7).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_NullHandlingUsingCustomConvertor()
      {
         // create custom mapper
         var gm = new GridifyMapper<TestClreplaced>(q => q.AllowNullSearch = false).GenerateMappings();

         // map any string to related property , also use Client convertor to handle custom scenarios
         gm.AddMap("date", g => g.MyDateTime!, q => (q == "null" ? null : q)!);

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering("date=null", gm)
            .ToList();

         var expected = _fakeRepository.Where(q => q.MyDateTime == null).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_CaseInsensitiveSearchUsingConvertor() //issue #21
      {
         var gq = new GridifyQuery { Filter = "name=BOB" };
         var gm = new GridifyMapper<TestClreplaced>()
            .AddMap("name", q => q.Name!.ToLower(), c => c.ToLower());

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq, gm)
            .ToList();

         var expected = _fakeRepository.Where(q => q.Name!.ToLower() == "BOB".ToLower()).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : FeatureParentFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetFeatureParentFromWebApp()
        {
            // Arrange
            var parentScope = SPFeatureScope.WebApplication;
            var parentUrl = TestContent.SharePointContainers.WebApplication.Url;

            using (SPSite site = new SPSite(TestContent.SharePointContainers.SiCoInActive.Url))
            {
                SPWebApplication parent = site.WebApplication;


            var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthyWebApp.Id];
               // var testFeatureFaulty = parent.Features[TestContent.TestFeatures.FaultyWebApp.Id];

                // Act
                var parentRetrievedWithScope = FeatureParent.GetFeatureParent(testFeatureHealthy, parentScope);
                var parentRetrievedNoScope = FeatureParent.GetFeatureParent(testFeatureHealthy);


                // replacedert
                replacedert.Equal(parent.Name, parentRetrievedWithScope.DisplayName);
                replacedert.Equal(parent.Id, parentRetrievedWithScope.Id);
                replacedert.Equal(parentUrl, parentRetrievedWithScope.Url);
                replacedert.Equal(parentScope, parentRetrievedWithScope.Scope);

                replacedert.Equal(parent.Name, parentRetrievedNoScope.DisplayName);
                replacedert.Equal(parent.Id, parentRetrievedNoScope.Id);
                replacedert.Equal(parentUrl, parentRetrievedNoScope.Url);
                replacedert.Equal(parentScope, parentRetrievedNoScope.Scope);
            }
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_EscapeCaseInsensitiveSearch() //issue #21
      {
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(@"name=Case\/i")
            .ToList();

         var expected = _fakeRepository.Where(q => q.Name == "Case/i").ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_DisableNullHandlingUsingMapper()
      {
         // create custom mapper
         var gm = new GridifyMapper<TestClreplaced>(q => q.AllowNullSearch = false) // default is true
            .GenerateMappings();

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering("MyDateTime=null", gm)
            .ToList();

         var expected = _fakeRepository.Where(q => q.MyDateTime.ToString() == "null").ToList();
         replacedert.Equal(expected, actual);
         replacedert.Empty(actual);
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #27
      public void ApplyFiltering_GreaterThanBetweenTwoStrings()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("name > ali").ToList();

         var expected = _fakeRepository.Where(q => string.Compare(q.Name, "ali", StringComparison.Ordinal) > 0).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : ActivatedFeatureFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetActivatedFeatureFromWebApp()
        {
            // Arrange
            var parentScope = SPFeatureScope.WebApplication;
            var parentUrl = TestContent.SharePointContainers.WebApplication.Url;

            using (SPSite site = new SPSite(TestContent.SharePointContainers.SiCoInActive.Url))
            {
                SPWebApplication parent = site.WebApplication;

                // Act

                var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthyWebApp.Id];
                // web app features cannot easily be reproduced in faulty state
                // var testFeatureFaulty = parent.Features[TestContent.TestFeatures.FaultyWebApp.Id];

                var featureParent = FeatureParent.GetFeatureParent(parent);


                var sharePointFeatureHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy);
                var sharePointFeatureRetrievedWithParentHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy, featureParent);

                // replacedert
                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Id, sharePointFeatureHealthy.Id);
                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Name, sharePointFeatureHealthy.Name);
                replacedert.Equal(featureParent.Url, sharePointFeatureHealthy.Parent.Url);
                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Version, sharePointFeatureHealthy.Version);
                replacedert.Equal(parentScope, sharePointFeatureHealthy.Scope);
                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Faulty, sharePointFeatureHealthy.Faulty);

                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Id, sharePointFeatureRetrievedWithParentHealthy.Id);
                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Name, sharePointFeatureRetrievedWithParentHealthy.Name);
                replacedert.Equal(featureParent.Url, sharePointFeatureRetrievedWithParentHealthy.Parent.Url);
                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Version, sharePointFeatureRetrievedWithParentHealthy.Version);
                replacedert.Equal(parentScope, sharePointFeatureRetrievedWithParentHealthy.Scope);
                replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Faulty, sharePointFeatureRetrievedWithParentHealthy.Faulty);
            }
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #27
      public void ApplyFiltering_LessThanOrEqualBetweenTwoStrings()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("name <= l").ToList();
         var expected = _fakeRepository.Where(q => string.Compare(q.Name, "l", StringComparison.Ordinal) <= 0).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Theory]
      [InlineData(@" name =\(LI\,AM\)", "(LI,AM)")]
      [InlineData(@" name =jessi=ca", "jessi=ca")]
      [InlineData(@" name =\\Liam", @"\Liam")]
      [InlineData(@" name =LI \| AM", @"LI | AM")]
      public void ApplyFiltering_EscapeSpecialCharacters(string textFilter, string rawText)
      {
         var gq = new GridifyQuery { Filter = textFilter };
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();
         var expected = _fakeRepository.Where(q => q.Name == rawText).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #27
      public void ApplyFiltering_GreaterThanOrEqual_CaseInsensitive_BetweenTwoStrings()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("name >= j/i").ToList();
         var expected = _fakeRepository.Where(q => string.Compare(q.Name, "j", StringComparison.OrdinalIgnoreCase) >= 0).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : AdminRepositoryGetFeatureDefinitionTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetFeatureDefinitionsAll()
        {
            // Arrange

            //Act
            var featureDefinitions = repository.GetFeatureDefinitions();
            
            var FDefinitionHealthyWeb = featureDefinitions.FirstOrDefault(f => f.Id == TestContent.TestFeatures.HealthyWeb.Id);
            var FDefinitionHealthySite = featureDefinitions.FirstOrDefault(f => f.Id == TestContent.TestFeatures.HealthySite.Id);
            var FDefinitionHealthyWebApp = featureDefinitions.FirstOrDefault(f => f.Id == TestContent.TestFeatures.HealthyWebApp.Id);
            var FDefinitionHealthyFarm = featureDefinitions.FirstOrDefault(f => f.Id == TestContent.TestFeatures.HealthyFarm.Id);
            var FDefinitionFaultyWeb = featureDefinitions.FirstOrDefault(f => f.Id == TestContent.TestFeatures.FaultyWeb.Id);
            var FDefinitionFaultySite = featureDefinitions.FirstOrDefault(f => f.Id == TestContent.TestFeatures.FaultySite.Id);


            //replacedert
            replacedert.NotNull(FDefinitionHealthyWeb);
            replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Name, FDefinitionHealthyWeb.Name);
            replacedert.Equal(TestContent.TestFeatures.HealthyWeb.replacedle, FDefinitionHealthyWeb.Getreplacedle);
            replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Scope, FDefinitionHealthyWeb.Scope);
            replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Version, FDefinitionHealthyWeb.DefinitionVersion);
            replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Faulty, FDefinitionHealthyWeb.Faulty);
            replacedert.Equal(TestContent.TestFeatures.HealthyWeb.TotalActivated, FDefinitionHealthyWeb.ActivatedFeatures.Count);

            replacedert.NotNull(FDefinitionHealthySite);
            replacedert.Equal(TestContent.TestFeatures.HealthySite.Name, FDefinitionHealthySite.Name);
            replacedert.Equal(TestContent.TestFeatures.HealthySite.replacedle, FDefinitionHealthySite.Getreplacedle);
            replacedert.Equal(TestContent.TestFeatures.HealthySite.Scope, FDefinitionHealthySite.Scope);
            replacedert.Equal(TestContent.TestFeatures.HealthySite.Version, FDefinitionHealthySite.DefinitionVersion);
            replacedert.Equal(TestContent.TestFeatures.HealthySite.Faulty, FDefinitionHealthySite.Faulty);
            replacedert.Equal(TestContent.TestFeatures.HealthySite.TotalActivated, FDefinitionHealthySite.ActivatedFeatures.Count);

            replacedert.NotNull(FDefinitionHealthyWebApp);
            replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Name, FDefinitionHealthyWebApp.Name);
            replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.replacedle, FDefinitionHealthyWebApp.Getreplacedle);
            replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Scope, FDefinitionHealthyWebApp.Scope);
            replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Version, FDefinitionHealthyWebApp.DefinitionVersion);
            replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.Faulty, FDefinitionHealthyWebApp.Faulty);
            replacedert.Equal(TestContent.TestFeatures.HealthyWebApp.TotalActivated, FDefinitionHealthyWebApp.ActivatedFeatures.Count);

            replacedert.NotNull(FDefinitionHealthyFarm);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Name, FDefinitionHealthyFarm.Name);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.replacedle, FDefinitionHealthyFarm.Getreplacedle);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Scope, FDefinitionHealthyFarm.Scope);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Version, FDefinitionHealthyFarm.DefinitionVersion);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.Faulty, FDefinitionHealthyFarm.Faulty);
            replacedert.Equal(TestContent.TestFeatures.HealthyFarm.TotalActivated, FDefinitionHealthyFarm.ActivatedFeatures.Count);

            replacedert.NotNull(FDefinitionFaultyWeb);
            replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Name, FDefinitionFaultyWeb.Name);
            replacedert.Equal(TestContent.TestFeatures.FaultyWeb.replacedle, FDefinitionFaultyWeb.Getreplacedle);
            replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Scope, FDefinitionFaultyWeb.Scope);
            replacedert.Equal(null, FDefinitionFaultyWeb.DefinitionVersion);
            replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Faulty, FDefinitionFaultyWeb.Faulty);
       //     replacedert.Equal(TestContent.TestFeatures.FaultyWeb.TotalActivated, FDefinitionFaultyWeb.ActivatedFeatures.Count); // for some reasons, 4 are counted, not 3 ... (?)

            replacedert.NotNull(FDefinitionFaultySite);
            replacedert.Equal(TestContent.TestFeatures.FaultySite.Name, FDefinitionFaultySite.Name);
            replacedert.Equal(TestContent.TestFeatures.FaultySite.replacedle, FDefinitionFaultySite.Getreplacedle);
            replacedert.Equal(TestContent.TestFeatures.FaultySite.Scope, FDefinitionFaultySite.Scope);
            replacedert.Equal(null, FDefinitionFaultySite.DefinitionVersion);
            replacedert.Equal(TestContent.TestFeatures.FaultySite.Faulty, FDefinitionFaultySite.Faulty);
         //   replacedert.Equal(TestContent.TestFeatures.FaultySite.TotalActivated, FDefinitionFaultySite.ActivatedFeatures.Count); // for some reasons, 2 are counted, not 1 ... (?)
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #25
      public void ApplyFiltering_NotEqual_ProcessingNullOrDefaultValue()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("tag!=").ToList();
         var expected = _fakeRepository.Where(q => !string.IsNullOrEmpty(q.Tag)).ToList();
         var expected2 = _fakeRepository.Where(q => q.Tag is not null && q.Tag != "").ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected2.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.Equal(expected2, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Theory]
      [InlineData(null)]
      [InlineData("")]
      public void ApplyFiltering_NullOrEmptyFilter_ShouldSkip(string? filter)
      {
         var gq = new GridifyQuery();
         if (filter == null)
            gq = null;
         else
            gq.Filter = filter;

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();

         var expected = _fakeRepository.ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #25
      public void ApplyFiltering_NotEqual_ProcessingNullOrDefaultValueNonStringTypes()
      {
         var actual = _fakeRepository.AsQueryable().ApplyFiltering("myGuid!=").ToList();
         var expected = _fakeRepository.Where(q => q.MyGuid != default).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : ActivatedFeatureFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetActivatedFeatureFromWeb()
        {
            // Arrange
            var parentScope = SPFeatureScope.Web;
            var parentUrl = TestContent.SharePointContainers.SiCoActivated.Url;

            using (SPSite site = new SPSite(parentUrl))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    var parent = web;

                    var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthyWeb.Id];
                    var testFeatureFaulty = parent.Features[TestContent.TestFeatures.FaultyWeb.Id];

                    var featureParent = new FeatureParent(parent.replacedle, parentUrl, parent.ID, parentScope);

                    // Act
                    var sharePointFeatureHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy);
                    var sharePointFeatureFaulty = ActivatedFeature.GetActivatedFeature(testFeatureFaulty);

                    var sharePointFeatureRetrievedWithParentHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy, featureParent);
                    var sharePointFeatureRetrievedWithParentFaulty = ActivatedFeature.GetActivatedFeature(testFeatureFaulty, featureParent);

                    // replacedert
                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Id, sharePointFeatureFaulty.Id);
                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Name, sharePointFeatureFaulty.Name);
                    replacedert.Equal(featureParent.Url, sharePointFeatureFaulty.Parent.Url);
                    replacedert.Equal(featureParent.DisplayName, sharePointFeatureFaulty.Parent.DisplayName);
                    replacedert.Equal(featureParent.Id, sharePointFeatureFaulty.Parent.Id);
                    replacedert.Equal(featureParent.Scope, sharePointFeatureFaulty.Parent.Scope);
                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Version, sharePointFeatureFaulty.Version);
                    replacedert.Equal(parentScope, sharePointFeatureFaulty.Scope);
                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Faulty, sharePointFeatureFaulty.Faulty);

                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Id, sharePointFeatureRetrievedWithParentFaulty.Id);
                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Name, sharePointFeatureRetrievedWithParentFaulty.Name);
                    replacedert.Equal(featureParent.Url, sharePointFeatureRetrievedWithParentFaulty.Parent.Url);
                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Version, sharePointFeatureRetrievedWithParentFaulty.Version);
                    replacedert.Equal(parentScope, sharePointFeatureRetrievedWithParentFaulty.Scope);
                    replacedert.Equal(TestContent.TestFeatures.FaultyWeb.Faulty, sharePointFeatureRetrievedWithParentFaulty.Faulty);

                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Id, sharePointFeatureHealthy.Id);
                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Name, sharePointFeatureHealthy.Name);
                    replacedert.Equal(featureParent.Url, sharePointFeatureHealthy.Parent.Url);
                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Version, sharePointFeatureHealthy.Version);
                    replacedert.Equal(parentScope, sharePointFeatureHealthy.Scope);
                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Faulty, sharePointFeatureHealthy.Faulty);

                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Id, sharePointFeatureRetrievedWithParentHealthy.Id);
                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Name, sharePointFeatureRetrievedWithParentHealthy.Name);
                    replacedert.Equal(featureParent.Url, sharePointFeatureRetrievedWithParentHealthy.Parent.Url);
                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Version, sharePointFeatureRetrievedWithParentHealthy.Version);
                    replacedert.Equal(parentScope, sharePointFeatureRetrievedWithParentHealthy.Scope);
                    replacedert.Equal(TestContent.TestFeatures.HealthyWeb.Faulty, sharePointFeatureRetrievedWithParentHealthy.Faulty);
                }
            }
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact] // issue #34
      public void ApplyFiltering_UnmappedFields_ShouldThrowException()
      {
         var gm = new GridifyMapper<TestClreplaced>()
            .AddMap("Id", q => q.Id);

         var exp = replacedert.Throws<GridifyMapperException>(() => _fakeRepository.AsQueryable().ApplyFiltering("name=John,id>0", gm).ToList());
         replacedert.Equal("Mapping 'name' not found",exp.Message); 
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_StartsWith()
      {
         const string gq = "name^A";

         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();

         var expected = _fakeRepository.Where(q => q.Name!.StartsWith("A")).ToList();

         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : AdminRepositoryGetHierarchyTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void ReceiveWebAppsContainsTestWebApp()
        {
            //Act
            var webApps = repository.GetSharePointWebApplications();
            var webApp = webApps.FirstOrDefault(w => w.Id == webAppId);

            //replacedert
            replacedert.NotNull(webApp);
            replacedert.Equal(TestContent.SharePointContainers.WebApplication.Url, webApp.Url);
        }

19 View Source File : ActivatedFeatureEqualTests.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        // Following needs to be equal:
        // FeatureId, LocationId
        public void ActiveFeaturesWithSameFeatureIdAndLocationIdAreEqual()
        {
            // Arrange
            var referenceFeatureDefinition = FeatureDefinitionFactory.GetFeatureDefinition(
                            Id, CompatibilityLevel,
                             Description,
                            DisplayName, Hidden,
                            Name, Properties,
                            Scope,
                            replacedle,
                            SolutionId, UiVersion,
                            Version
                           );

            ActivatedFeature referenceFeature = ActivatedFeatureFactory.GetActivatedFeature(
                  referenceFeatureDefinition.UniqueIdentifier,
                  Locations.ActivatedRootWeb.Guid.ToString(),
                  referenceFeatureDefinition.DisplayName,
                  Faulty, Properties, TimeActivated,
                  Version, referenceFeatureDefinition.Version
                  );



            // Act

            var definitionDifferent = FeatureDefinitionFactory.GetFeatureDefinition(
                   Id, CompatibilityLevel,
                    null,
                   null, HiddenDifferent,
                   Name, null,
                   Scope,
                   null,
                   Guid.Empty, null,
                   null, 
                   null
                  );

            var equalFeature = ActivatedFeatureFactory.GetActivatedFeature(
                 definitionDifferent.UniqueIdentifier,
                 Locations.ActivatedRootWeb.Guid.ToString(),
                 definitionDifferent.DisplayName,
                 FaultyDifferent, 
                 PropertiesDifferent, 
                 TimeActivatedDifferent,
                 VersionDifferent, 
                 definitionDifferent.Version, 
                 DefinitioninstallationScopeDifferent
                 );

            var equalFeatureEmpty = ActivatedFeatureFactory.GetActivatedFeature(
                 Id.ToString(),
                 Locations.ActivatedRootWeb.Guid.ToString(),
                 null,
                 FaultyDifferent, null, DateTime.MinValue,
                 null, null
                 );

            // replacedert

            replacedert.Equal(referenceFeature, equalFeature);

            replacedert.Equal(referenceFeature, equalFeatureEmpty);


        }

19 View Source File : ActivatedFeatureFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetActivatedFeatureFromSite()
        {
            // Arrange
            var parentScope = SPFeatureScope.Site;
            var parentUrl = TestContent.SharePointContainers.SiCoActivated.Url;

            using (SPSite site = new SPSite(parentUrl))
            {
                var parent = site;

                var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthySite.Id];
                var testFeatureFaulty = parent.Features[TestContent.TestFeatures.FaultySite.Id];

                var featureParent = new FeatureParent(parent.RootWeb.replacedle, parentUrl, parent.ID, parentScope);

                // Act
                var sharePointFeatureHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy);
                var sharePointFeatureFaulty = ActivatedFeature.GetActivatedFeature(testFeatureFaulty);

                var sharePointFeatureRetrievedWithParentHealthy = ActivatedFeature.GetActivatedFeature(testFeatureHealthy, featureParent);
                var sharePointFeatureRetrievedWithParentFaulty = ActivatedFeature.GetActivatedFeature(testFeatureFaulty, featureParent);

                // replacedert
                replacedert.Equal(TestContent.TestFeatures.FaultySite.Id, sharePointFeatureFaulty.Id);
                replacedert.Equal(TestContent.TestFeatures.FaultySite.Name, sharePointFeatureFaulty.Name);
                replacedert.Equal(featureParent.Url, sharePointFeatureFaulty.Parent.Url);
                replacedert.Equal(featureParent.DisplayName, sharePointFeatureFaulty.Parent.DisplayName);
                replacedert.Equal(featureParent.Id, sharePointFeatureFaulty.Parent.Id);
                replacedert.Equal(featureParent.Scope, sharePointFeatureFaulty.Parent.Scope);
                replacedert.Equal(TestContent.TestFeatures.FaultySite.Version, sharePointFeatureFaulty.Version);
                replacedert.Equal(parentScope, sharePointFeatureFaulty.Scope);
                replacedert.Equal(TestContent.TestFeatures.FaultySite.Faulty, sharePointFeatureFaulty.Faulty);

                replacedert.Equal(TestContent.TestFeatures.FaultySite.Id, sharePointFeatureRetrievedWithParentFaulty.Id);
                replacedert.Equal(TestContent.TestFeatures.FaultySite.Name, sharePointFeatureRetrievedWithParentFaulty.Name);
                replacedert.Equal(featureParent.Url, sharePointFeatureRetrievedWithParentFaulty.Parent.Url);
                replacedert.Equal(TestContent.TestFeatures.FaultySite.Version, sharePointFeatureRetrievedWithParentFaulty.Version);
                replacedert.Equal(parentScope, sharePointFeatureRetrievedWithParentFaulty.Scope);
                replacedert.Equal(TestContent.TestFeatures.FaultySite.Faulty, sharePointFeatureRetrievedWithParentFaulty.Faulty);

                replacedert.Equal(TestContent.TestFeatures.HealthySite.Id, sharePointFeatureHealthy.Id);
                replacedert.Equal(TestContent.TestFeatures.HealthySite.Name, sharePointFeatureHealthy.Name);
                replacedert.Equal(featureParent.Url, sharePointFeatureHealthy.Parent.Url);
                replacedert.Equal(TestContent.TestFeatures.HealthySite.Version, sharePointFeatureHealthy.Version);
                replacedert.Equal(parentScope, sharePointFeatureHealthy.Scope);
                replacedert.Equal(TestContent.TestFeatures.HealthySite.Faulty, sharePointFeatureHealthy.Faulty);

                replacedert.Equal(TestContent.TestFeatures.HealthySite.Id, sharePointFeatureRetrievedWithParentHealthy.Id);
                replacedert.Equal(TestContent.TestFeatures.HealthySite.Name, sharePointFeatureRetrievedWithParentHealthy.Name);
                replacedert.Equal(featureParent.Url, sharePointFeatureRetrievedWithParentHealthy.Parent.Url);
                replacedert.Equal(TestContent.TestFeatures.HealthySite.Version, sharePointFeatureRetrievedWithParentHealthy.Version);
                replacedert.Equal(parentScope, sharePointFeatureRetrievedWithParentHealthy.Scope);
                replacedert.Equal(TestContent.TestFeatures.HealthySite.Faulty, sharePointFeatureRetrievedWithParentHealthy.Faulty);
            }
        }

19 View Source File : FeatureParentFactoryTest.cs
License : Microsoft Public License
Project Creator : achimismaili

[Fact]
        public void CanGetFeatureParentFromSite()
        {
            // Arrange
            var parentScope = SPFeatureScope.Site;
            var parentUrl = TestContent.SharePointContainers.SiCoActivated.Url;

            using (SPSite parent = new SPSite(parentUrl))
            {
                var testFeatureHealthy = parent.Features[TestContent.TestFeatures.HealthySite.Id];
                var testFeatureFaulty = parent.Features[TestContent.TestFeatures.HealthySite.Id];

                // Act
                var parentHealthy = FeatureParent.GetFeatureParent(testFeatureHealthy);
                var parentFaulty = FeatureParent.GetFeatureParent(testFeatureFaulty);
                var parentRetrievedWithScopeHealthy = FeatureParent.GetFeatureParent(testFeatureHealthy, parentScope);
                var parentRetrievedWithScopeFaulty = FeatureParent.GetFeatureParent(testFeatureFaulty, parentScope);

                // replacedert
                replacedert.Equal(parent.RootWeb.replacedle, parentHealthy.DisplayName);
                replacedert.Equal(parent.ID, parentHealthy.Id);
                replacedert.Equal(parentUrl, parentHealthy.Url);
                replacedert.Equal(parentScope, parentHealthy.Scope);

                replacedert.Equal(parent.RootWeb.replacedle, parentFaulty.DisplayName);
                replacedert.Equal(parent.ID, parentFaulty.Id);
                replacedert.Equal(parentUrl, parentFaulty.Url);
                replacedert.Equal(parentScope, parentFaulty.Scope);

                replacedert.Equal(parent.RootWeb.replacedle, parentRetrievedWithScopeHealthy.DisplayName);
                replacedert.Equal(parent.ID, parentRetrievedWithScopeHealthy.Id);
                replacedert.Equal(parentUrl, parentRetrievedWithScopeHealthy.Url);
                replacedert.Equal(parentScope, parentRetrievedWithScopeHealthy.Scope);

                replacedert.Equal(parent.RootWeb.replacedle, parentRetrievedWithScopeFaulty.DisplayName);
                replacedert.Equal(parent.ID, parentRetrievedWithScopeFaulty.Id);
                replacedert.Equal(parentUrl, parentRetrievedWithScopeFaulty.Url);
                replacedert.Equal(parentScope, parentRetrievedWithScopeFaulty.Scope);




            }
        }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_SingleField_GridifyQuery()
      {
         var gq = new GridifyQuery { Filter = "name=John" };
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering(gq)
            .ToList();
         var expected = _fakeRepository.Where(q => q.Name == "John").ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

19 View Source File : GridifyExtensionsShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void ApplyFiltering_ComplexWithParenthesis()
      {
         var actual = _fakeRepository.AsQueryable()
            .ApplyFiltering("(name=*J|name=*S),(Id<5)")
            .ToList();
         var expected = _fakeRepository.Where(q => (q.Name!.Contains("J") || q.Name.Contains("S")) && q.Id < 5).ToList();
         replacedert.Equal(expected.Count, actual.Count);
         replacedert.Equal(expected, actual);
         replacedert.True(actual.Any());
      }

See More Examples