2018-08-08 19:18:01 +02:00
|
|
|
|
// ------------------------------------------------------------
|
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
|
|
|
|
|
// ------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
using System;
|
2018-08-08 20:42:59 +02:00
|
|
|
|
using Microsoft.OData.Edm;
|
2018-08-08 19:18:01 +02:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.OpenApi.OData.Edm.Tests
|
|
|
|
|
{
|
2018-08-08 20:42:59 +02:00
|
|
|
|
public class ODataOperationISegmentTests
|
2018-08-08 19:18:01 +02:00
|
|
|
|
{
|
2018-08-08 20:42:59 +02:00
|
|
|
|
private IEdmOperation _operation = new EdmAction("NS", "MyAction", null);
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void CtorThrowArgumentNullOperation()
|
|
|
|
|
{
|
|
|
|
|
// Arrange & Act & Assert
|
|
|
|
|
Assert.Throws<ArgumentNullException>("operation", () => new ODataOperationSegment(operation: null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void CtorSetOperationProperty()
|
|
|
|
|
{
|
|
|
|
|
// Arrange & Act
|
|
|
|
|
var segment = new ODataOperationSegment(_operation);
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
|
Assert.Same(_operation, segment.Operation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void GetEntityTypeThrowsNotImplementedException()
|
|
|
|
|
{
|
|
|
|
|
// Arrange & Act
|
|
|
|
|
var segment = new ODataOperationSegment(_operation);
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
|
Assert.Throws<NotImplementedException>(() => segment.EntityType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void GetNameReturnsCorrectNameString()
|
|
|
|
|
{
|
|
|
|
|
// Arrange & Act
|
|
|
|
|
var segment = new ODataOperationSegment(_operation);
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
|
Assert.Equal("MyAction", segment.Name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ToStringReturnsCorrectNameString()
|
|
|
|
|
{
|
|
|
|
|
// Arrange & Act
|
|
|
|
|
var segment = new ODataOperationSegment(_operation);
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
|
Assert.Equal("MyAction", segment.ToString());
|
|
|
|
|
}
|
2018-08-08 19:18:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|