Skip to content

Commit

Permalink
Remove fluentAssernt from OData.Core test project
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhg committed Sep 22, 2019
1 parent e65ec66 commit 14a4b12
Show file tree
Hide file tree
Showing 151 changed files with 4,633 additions and 4,528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public OperationImportSegment(IEnumerable<IEdmOperationImport> operationImports,
: this()
{
// DEVNOTE: This ctor is only used in Select and Expand currently.
ExceptionUtils.CheckArgumentNotNull(operationImports, "operations");
ExceptionUtils.CheckArgumentNotNull(operationImports, "operationImports");
this.operationImports = new ReadOnlyCollection<IEdmOperationImport>(operationImports.ToList());

// check for empty after we copy locally, so that we don't do multiple enumeration of input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed class EndPathToken : PathToken
/// <param name="nextToken">The NextToken token to access the property on. </param>
public EndPathToken(string identifier, QueryToken nextToken)
{
ExceptionUtils.CheckArgumentStringNotNullOrEmpty(identifier, "Identifier");
ExceptionUtils.CheckArgumentStringNotNullOrEmpty(identifier, "identifier");

this.identifier = identifier;
this.nextToken = nextToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
<AssemblyOriginatorKeyFile>..\..\..\..\tools\StrongNamePublicKeys\testkey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\sln\packages\FluentAssertions.2.0.0.1\lib\net40\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.XML" />
Expand Down Expand Up @@ -444,7 +440,6 @@
<Compile Include="..\GeographyTypeConverterTests.cs" />
<Compile Include="..\ODataVersionCacheTests.cs" />
<Compile Include="..\Properties\AssemblyInfo.cs" />
<Compile Include="..\UriParser\FluentAssertionsExtensions.cs" />
<Compile Include="..\UriParser\HardCodedTestModel.cs" />
<Compile Include="..\UriParser\NodeAssertions.cs" />
<Compile Include="..\UriParser\ODataQueryOptionParserTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

using System;
using System.Collections.Generic;
using FluentAssertions;
using Microsoft.OData.JsonLight;
using Xunit;
using ErrorStrings = Microsoft.OData.Strings;
Expand All @@ -20,40 +19,40 @@ public void DuplicateInstanceODataAnnotationShouldFail()
{
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
Action action = () => duplicateChecker.MarkPropertyAsProcessed(JsonLightConstants.ODataAnnotationNamespacePrefix + "name");
action.ShouldNotThrow();
action.ShouldThrow<ODataException>().WithMessage(ErrorStrings.DuplicateAnnotationNotAllowed(JsonLightConstants.ODataAnnotationNamespacePrefix + "name"));
action.DoesNotThrow();
action.Throws<ODataException>(ErrorStrings.DuplicateAnnotationNotAllowed(JsonLightConstants.ODataAnnotationNamespacePrefix + "name"));
}

[Fact]
public void DuplicatePropertyODataAnnotationShouldFail()
{
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
Action action = () => duplicateChecker.AddODataPropertyAnnotation("property", JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "SomeValue");
action.ShouldNotThrow();
action.ShouldThrow<ODataException>().WithMessage(ErrorStrings.DuplicateAnnotationForPropertyNotAllowed(JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "property"));
action.DoesNotThrow();
action.Throws<ODataException>(ErrorStrings.DuplicateAnnotationForPropertyNotAllowed(JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "property"));
}

[Fact]
public void DuplicatePropertyCustomAnnotationShouldNotFail()
{
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
Action action = () => duplicateChecker.AddCustomPropertyAnnotation("property", "custom.name", "value");
action.ShouldNotThrow();
action.ShouldNotThrow();
action.DoesNotThrow();
action.DoesNotThrow();
}

[Fact]
public void NoAnnotationsForObjectScopeAddedShouldReturnEmpty()
{
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
duplicateChecker.GetODataPropertyAnnotations(string.Empty).Should().BeEmpty();
Assert.Empty(duplicateChecker.GetODataPropertyAnnotations(string.Empty));
}

[Fact]
public void NoAnnotationsForPropertyAddedShouldReturnEmpty()
{
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
duplicateChecker.GetODataPropertyAnnotations("property").Should().BeEmpty();
Assert.Empty(duplicateChecker.GetODataPropertyAnnotations("property"));
}

[Fact]
Expand All @@ -62,7 +61,7 @@ public void OnlyCustomAnnotationsForPropertyAddedShouldReturnEmpty()
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
duplicateChecker.AddCustomPropertyAnnotation("property", "custom.annotation", "value");
duplicateChecker.AddCustomPropertyAnnotation("property", "custom.annotation2", "value");
duplicateChecker.GetODataPropertyAnnotations("property").Should().BeEmpty();
Assert.Empty(duplicateChecker.GetODataPropertyAnnotations("property"));
}

[Fact]
Expand All @@ -71,11 +70,12 @@ public void AnnotationsForPropertyShouldBeStored()
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
duplicateChecker.AddODataPropertyAnnotation("property", JsonLightConstants.ODataAnnotationNamespacePrefix + "one", 1);
duplicateChecker.AddODataPropertyAnnotation("property", JsonLightConstants.ODataAnnotationNamespacePrefix + "two", "Two");
duplicateChecker.GetODataPropertyAnnotations("property").Should().Equal(new Dictionary<string, object>()
var annotations = duplicateChecker.GetODataPropertyAnnotations("property");
Assert.Equal(new Dictionary<string, object>()
{
{ JsonLightConstants.ODataAnnotationNamespacePrefix + "one", 1 },
{ JsonLightConstants.ODataAnnotationNamespacePrefix + "two", "Two" }
});
}, annotations);
}

[Fact]
Expand All @@ -84,9 +84,9 @@ public void MarkPropertyAsProcessedWithNoPropertyShouldWork()
PropertyAndAnnotationCollector duplicateChecker = new PropertyAndAnnotationCollector(true);
duplicateChecker.MarkPropertyAsProcessed("property");
Action odataAction = () => duplicateChecker.AddODataPropertyAnnotation("property", JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "value");
odataAction.ShouldThrow<ODataException>().WithMessage(ErrorStrings.PropertyAnnotationAfterTheProperty(JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "property"));
odataAction.Throws<ODataException>(ErrorStrings.PropertyAnnotationAfterTheProperty(JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "property"));
Action customAction = () => duplicateChecker.AddCustomPropertyAnnotation("property", "custom.name", "value");
customAction.ShouldThrow<ODataException>().WithMessage(ErrorStrings.PropertyAnnotationAfterTheProperty("custom.name", "property"));
customAction.Throws<ODataException>(ErrorStrings.PropertyAnnotationAfterTheProperty("custom.name", "property"));
}

[Fact]
Expand All @@ -96,9 +96,9 @@ public void MarkPropertyAsProcessedWithSomeAnnotationsShouldWork()
duplicateChecker.AddODataPropertyAnnotation("property", JsonLightConstants.ODataAnnotationNamespacePrefix + "first", 42);
duplicateChecker.MarkPropertyAsProcessed("property");
Action odataAction = () => duplicateChecker.AddODataPropertyAnnotation("property", JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "value");
odataAction.ShouldThrow<ODataException>().WithMessage(ErrorStrings.PropertyAnnotationAfterTheProperty(JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "property"));
odataAction.Throws<ODataException>(ErrorStrings.PropertyAnnotationAfterTheProperty(JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "property"));
Action customAction = () => duplicateChecker.AddCustomPropertyAnnotation("property", "custom.name", "value");
customAction.ShouldThrow<ODataException>().WithMessage(ErrorStrings.PropertyAnnotationAfterTheProperty("custom.name", "property"));
customAction.Throws<ODataException>(ErrorStrings.PropertyAnnotationAfterTheProperty("custom.name", "property"));
}
}
}
Loading

0 comments on commit 14a4b12

Please sign in to comment.