Aufgrund einer Wartung wird GitLab am 18.05. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 18.05. between 8:00 and 9:00 am.

ResourceTypeControllerTests.cs 1.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
using Coscine.Api.Project.Controllers;
using Microsoft.AspNetCore.Mvc;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Coscine.Api.Project.Tests
{
    [TestFixture]
    public class ResourceTypeControllerTests : DefaultControllerTests<ResourceTypeController>
    {
        public ResourceTypeControllerTests() : base(new ResourceTypeController())
        {
        }

        [Test]
        public void TestGettingFields()
        {
            var actionResult = Controller.Fields(Resources[0].Type.Id.ToString());
23
            Assert.IsTrue(actionResult.GetType() == typeof(JsonResult));
24

25 26
            JsonResult result = (JsonResult)actionResult;
            List<string> fields = (List<string>) result.Value;
27
            if(fields.Count() == 2)
28 29
            {
                Assert.IsTrue(fields[0] == "BucketName");
30
                Assert.IsTrue(fields[1] == "Size");
31 32 33 34 35 36 37 38
            }
            else
            {
                Assert.Fail("Wrong field count!");
            }
        }
    }
}