public void MapServerRequestToResponse()
        {
            var mapper = new ApiArtistServerModelMapper();
            var model  = new ApiArtistServerRequestModel();

            model.SetProperties("A", "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", "A", "A", "A", "A", "A");
            ApiArtistServerResponseModel response = mapper.MapServerRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.AspNetUserId.Should().Be("A");
            response.Bio.Should().Be("A");
            response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Facebook.Should().Be("A");
            response.Name.Should().Be("A");
            response.SoundCloud.Should().Be("A");
            response.Twitter.Should().Be("A");
            response.Venmo.Should().Be("A");
            response.Website.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiArtistServerModelMapper();
            var model  = new ApiArtistServerRequestModel();

            model.SetProperties("A", "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A", "A", "A", "A", "A", "A");

            JsonPatchDocument <ApiArtistServerRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiArtistServerRequestModel();

            patch.ApplyTo(response);
            response.AspNetUserId.Should().Be("A");
            response.Bio.Should().Be("A");
            response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Facebook.Should().Be("A");
            response.Name.Should().Be("A");
            response.SoundCloud.Should().Be("A");
            response.Twitter.Should().Be("A");
            response.Venmo.Should().Be("A");
            response.Website.Should().Be("A");
        }
Example #3
0
        public virtual async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer           testServer = new TestServer(builder);
            var                  client     = new ApiClient(testServer.CreateClient());
            ApplicationDbContext context    = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            IArtistService service = testServer.Host.Services.GetService(typeof(IArtistService)) as IArtistService;
            var            model   = new ApiArtistServerRequestModel();

            model.SetProperties("B", "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B", "B", "B", "B", "B", "B");
            CreateResponse <ApiArtistServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.ArtistDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiArtistServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }