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

/MusicStore.UnitTest/CreateCartCommandUnitTest.cs

https://github.com/satish860/MusicStoreAPI
C# | 36 lines | 34 code | 2 blank | 0 comment | 0 complexity | d15f1a9b3dda24665c58f4c2cab933a9 MD5 | raw file
  1. using MusicStore.Api;
  2. using MusicStore.Api.CommandHandlers;
  3. using MusicStore.Api.Models;
  4. using Simple.Data;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using FluentAssertions;
  11. using NUnit.Framework;
  12. using System.Web.Http.SelfHost;
  13. namespace MusicStore.UnitTest
  14. {
  15. [TestFixture]
  16. public class CreateCartCommandUnitTest
  17. {
  18. [TestFixtureSetUp]
  19. public void SetUp()
  20. {
  21. new MusicStoreBootStrap(new HttpSelfHostConfiguration("http://localhost:8008"))
  22. .ConfigureDatabaseForTest()
  23. .SeedDatabase();
  24. }
  25. [Test]
  26. public void Should_be_able_to_Create_the_Command()
  27. {
  28. ICommandHandler<CreateCartCommand> CreateCartCommandHandler = TestInstance.CreateCartCommandHandler;
  29. CreateCartCommandHandler.Execute(new CreateCartCommand { Id = 1 });
  30. Cart cart=Database.Open().Cart.FindById(1);
  31. cart.Id.Should().Be(1);
  32. }
  33. }
  34. }