context: // ReSharper disable All
  using System.Collections.Generic;
  using System.Diagnostics;
  using System.Dynamic;
  using System.Linq;
  using System.Net;
  using System.Net.Http;
  using System.Web.Http;
  using MixERP.Net.Api.Framework;
  using MixERP.Net.ApplicationState.Cache;
  using MixERP.Net.Common.Extensions;
  using MixERP.Net.EntityParser;
  using MixERP.Net.Framework;
  using Newtonsoft.Json;
  using Newtonsoft.Json.Linq;
  using MixERP.Net.Schemas.Core.Data;
  using MixERP.Net.Api.Core.Fakes;
  using Xunit;
  
  namespace MixERP.Net.Api.Core.Tests
  {
      public class AttributeTests
      {
          public static CoreAttributeController Fixture()
          {
              CoreAttributeController controller = new CoreAttributeController(new AttributeRepository(), "", new LoginView());
              return controller;
          }
  
          [Fact]
          [Conditional("Debug")]
          public void CountEntityColumns()
          {
              EntityView entityView = Fixture().GetEntityView();
              Assert.Null(entityView.Columns);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void Count()
          {
              long count = Fixture().Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void GetAll()
          {
              int count = Fixture().GetAll().Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void Export()
          {
              int count = Fixture().Export().Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void Get()
          {
              MixERP.Net.Entities.Core.Attribute attribute = Fixture().Get(0);
              Assert.NotNull(attribute);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void First()
          {
              MixERP.Net.Entities.Core.Attribute attribute = Fixture().GetFirst();
              Assert.NotNull(attribute);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void Previous()
          {
              MixERP.Net.Entities.Core.Attribute attribute = Fixture().GetPrevious(0);
              Assert.NotNull(attribute);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void Next()
          {
              MixERP.Net.Entities.Core.Attribute attribute = Fixture().GetNext(0);
              Assert.NotNull(attribute);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void Last()
          {
              MixERP.Net.Entities.Core.Attribute attribute = Fixture().GetLast();
              Assert.NotNull(attribute);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void GetMultiple()
          {
              IEnumerable<MixERP.Net.Entities.Core.Attribute> attributes = Fixture().Get(new int[] { });
              Assert.NotNull(attributes);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void GetPaginatedResult()
          {
              int count = Fixture().GetPaginatedResult().Count();
              Assert.Equal(1, count);
  
              count = Fixture().GetPaginatedResult(1).Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void CountWhere()
          {
              long count = Fixture().CountWhere(new JArray());
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void GetWhere()
          {
              int count = Fixture().GetWhere(1, new JArray()).Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void CountFiltered()
          {
              long count = Fixture().CountFiltered("");
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void GetFiltered()
          {
              int count = Fixture().GetFiltered(1, "").Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void GetDisplayFields()
          {
              int count = Fixture().GetDisplayFields().Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void GetCustomFields()
          {
              int count = Fixture().GetCustomFields().Count();
              Assert.Equal(1, count);
  
              count = Fixture().GetCustomFields("").Count();
              Assert.Equal(1, count);
          }
  
          [Fact]
          [Conditional("Debug")]
          public void AddOrEdit()
          {
              try
              {
                  var form = new JArray { null, null };
                  Fixture().AddOrEdit(form);
              }
              catch (HttpResponseException ex)
              {
                  Assert.Equal(HttpStatusCode.MethodNotAllowed, ex.Response.StatusCode);
              }
          }
  
  
          [Fact]
          [Conditional("Debug")]
          public void Add()
          {
              try
              {
                  Fixture().Add(null);
              }
              catch (HttpResponseException ex)
              {
                  Assert.Equal(HttpStatusCode.MethodNotAllowed, ex.Response.StatusCode);
              }
          }
  
          [Fact]
          [Conditional("Debug")]
          public void Edit()
          {
              try
              {
                  Fixture().Edit(0, null);
              }
              catch (HttpResponseException ex)
              {
                  Assert.Equal(HttpStatusCode.MethodNotAllowed, ex.Response.StatusCode);
              }
          }
  
          [Fact]
          [Conditional("Debug")]
          public void BulkImport()
          {
              var collection = new JArray { null, null, null, null };
  
gt:             var actual = Fixture().BulkImport(collection);