PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/MusicStore.UnitTest/CategoryQueryTest.cs

https://github.com/satish860/MusicStoreAPI
C# | 40 lines | 37 code | 3 blank | 0 comment | 0 complexity | 5735a7edd9624f1ac496162384855ee5 MD5 | raw file
  1. using FluentAssertions;
  2. using MusicStore.Api;
  3. using MusicStore.Api.Models;
  4. using MusicStore.Api.Query;
  5. using NUnit.Framework;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Web.Http.SelfHost;
  9. namespace MusicStore.UnitTest
  10. {
  11. [TestFixture]
  12. public class CategoryQueryTest
  13. {
  14. [TestFixtureSetUp]
  15. public void SetUp()
  16. {
  17. new MusicStoreBootStrap(new HttpSelfHostConfiguration("http://localhost:8008"))
  18. .ConfigureDatabaseForTest()
  19. .SeedDatabase();
  20. }
  21. [Test]
  22. public void Should_be_able_to_Get_the_CategoryViewModel()
  23. {
  24. IQueryFor<NullArgument, IEnumerable<CategoryCountViewModel>> categoryCountViewModel = new CategoryAndCountQuery();
  25. IEnumerable<CategoryCountViewModel> CategoryCount = categoryCountViewModel.Execute(NullArgument.BuildDefault());
  26. CategoryCount.Count().Should().Be(8);
  27. }
  28. [Test]
  29. public void Should_be_able_to_get_the_Countof_the_Category()
  30. {
  31. IQueryFor<NullArgument, IEnumerable<CategoryCountViewModel>> categoryCountViewModel = new CategoryAndCountQuery();
  32. IEnumerable<CategoryCountViewModel> CategoryCount = categoryCountViewModel.Execute(NullArgument.BuildDefault());
  33. CategoryCount.First().Count.Should().Be(4);
  34. CategoryCount.First().CategoryName.Should().Be("Mobile");
  35. }
  36. }
  37. }