-
Notifications
You must be signed in to change notification settings - Fork 166
/
Copy pathtype-enum-fixed.cs
35 lines (32 loc) · 1.24 KB
/
type-enum-fixed.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Threading.Tasks;
using AutoRest.TestServer.Tests.Infrastructure;
using Azure;
using NUnit.Framework;
using _Type._Enum.Fixed;
using _Type._Enum.Fixed.Models;
namespace CadlRanchProjects.Tests
{
public class TypeEnumFixedTests : CadlRanchTestBase
{
[Test]
public Task Type_Enum_Fixed_String_getKnownValue() => Test(async (host) =>
{
var response = await new FixedClient(host, null).GetStringClient().GetKnownValueAsync();
Assert.AreEqual(DaysOfWeekEnum.Monday, response.Value);
});
[Test]
public Task Type_Enum_Fixed_String_putKnownValue() => Test(async (host) =>
{
var response = await new FixedClient(host, null).GetStringClient().PutKnownValueAsync(DaysOfWeekEnum.Monday);
Assert.AreEqual(204, response.Status);
});
[Test]
public Task Type_Enum_Fixed_String_putUnknownValue() => Test((host) =>
{
var exception = Assert.ThrowsAsync<RequestFailedException>(() => new FixedClient(host, null).GetStringClient().PutUnknownValueAsync(BinaryData.FromObjectAsJson("Weekend")));
Assert.AreEqual(500, exception.Status);
return Task.CompletedTask;
});
}
}