public void TaskFailTest()
        {
            var task   = new GetArtist(EmptyDbContext);
            var result = task.DoTask(0);

            Assert.IsFalse(result.Success);
            Assert.IsNotNull(result.Exception);
        }
        public void TaskSuccessTest()
        {
            var testArtist      = TestsModel.Artist;
            var addArtistTask   = new AddArtist(DbContext, new FormattingService());
            var addArtistResult = addArtistTask.DoTask(testArtist);

            Assert.IsTrue(addArtistResult.Success);
            Assert.IsNull(addArtistResult.Exception);

            var task     = new UpdateArtist(DbContext, new FormattingService());
            var toUpdate = testArtist;

            UpdateArtistModel(toUpdate);
            var result = task.DoTask(toUpdate);

            Assert.IsTrue(result.Success);
            Assert.IsNull(result.Exception);
            Assert.IsNull(result.Data);

            var getArtistTask     = new GetArtist(DbContext);
            var artist            = getArtistTask.DoTask(toUpdate.Id)?.Data;
            var formattingService = new FormattingService();

            Assert.IsNotNull(artist);
            Assert.AreEqual(toUpdate.Name, artist.Name);
            Assert.AreEqual(formattingService.FormatTaxId(toUpdate.TaxId), artist.TaxId);
            Assert.AreEqual(toUpdate.Email, artist.Email);
            Assert.AreEqual(toUpdate.Address.Street, artist.Address.Street);
            Assert.AreEqual(toUpdate.Address.City, artist.Address.City);
            Assert.AreEqual(toUpdate.Address.Region, artist.Address.Region);
            Assert.AreEqual(toUpdate.Address.PostalCode, artist.Address.PostalCode);
            Assert.AreEqual(toUpdate.Address.Country.Name, artist.Address.Country.Name);
            Assert.AreEqual(toUpdate.HasServiceMark, artist.HasServiceMark);
            Assert.AreEqual(toUpdate.WebsiteUrl, artist.WebsiteUrl);
            Assert.AreEqual(toUpdate.PressKitUrl, artist.PressKitUrl);
            if (testArtist.RecordLabel != null)
            {
                Assert.AreEqual(toUpdate.RecordLabel.Name, artist.RecordLabel.Name);
                Assert.AreEqual(formattingService.FormatTaxId(toUpdate.RecordLabel.TaxId), artist.RecordLabel.TaxId);
                Assert.AreEqual(toUpdate.RecordLabel.Email, artist.RecordLabel.Email);
                Assert.AreEqual(formattingService.FormatPhoneNumber(toUpdate.RecordLabel.Phone), artist.RecordLabel.Phone);
                Assert.IsNotNull(toUpdate.RecordLabel.Address);
                Assert.AreEqual(toUpdate.RecordLabel.Address.Street, artist.RecordLabel.Address.Street);
                Assert.AreEqual(toUpdate.RecordLabel.Address.City, artist.RecordLabel.Address.City);
                Assert.AreEqual(toUpdate.RecordLabel.Address.Region, artist.RecordLabel.Address.Region);
                Assert.AreEqual(toUpdate.RecordLabel.Address.PostalCode, artist.RecordLabel.Address.PostalCode);
                Assert.IsNotNull(toUpdate.RecordLabel.Address.Country);
                Assert.AreEqual(toUpdate.RecordLabel.Address.Country.Name, artist.RecordLabel.Address.Country.Name);
                Assert.AreEqual(toUpdate.RecordLabel.Address.Country.IsoCode, artist.RecordLabel.Address.Country.IsoCode);
            }

            var removeArtistTask   = new RemoveArtist(DbContext);
            var removeArtistResult = removeArtistTask.DoTask(artist);

            Assert.IsTrue(removeArtistResult.Success);
            Assert.IsNull(removeArtistResult.Exception);
        }
        public void TaskSuccessTest()
        {
            var addArtistTask = new AddArtist(DbContext, new FormattingService());
            var testArtist    = TestsModel.Artist;
            var testArtistId  = addArtistTask.DoTask(testArtist);

            Assert.IsTrue(testArtistId.Data.HasValue);

            var task   = new GetArtist(DbContext);
            var result = task.DoTask(testArtistId.Data.Value);

            Assert.IsTrue(result.Success);
            Assert.IsNull(result.Exception);

            var artist = result.Data;

            Assert.IsNotNull(artist);
            Assert.AreEqual(testArtist.Name, artist.Name);
            Assert.AreEqual(testArtist.TaxId, artist.TaxId);
            Assert.AreEqual(testArtist.Email, artist.Email);
            Assert.IsNotNull(artist.Address);
            Assert.AreEqual(testArtist.Address.Street, artist.Address.Street);
            Assert.AreEqual(testArtist.Address.City, artist.Address.City);
            Assert.AreEqual(testArtist.Address.Region, artist.Address.Region);
            Assert.AreEqual(testArtist.Address.PostalCode, artist.Address.PostalCode);
            Assert.IsNotNull(artist.Address.Country);
            Assert.AreEqual(testArtist.Address.Country.Name, artist.Address.Country.Name);
            Assert.AreEqual(testArtist.Address.Country.IsoCode, artist.Address.Country.IsoCode);
            Assert.AreEqual(testArtist.HasServiceMark, artist.HasServiceMark);
            Assert.AreEqual(testArtist.WebsiteUrl, artist.WebsiteUrl);
            Assert.AreEqual(testArtist.PressKitUrl, artist.PressKitUrl);
            if (testArtist.RecordLabel != null)
            {
                Assert.AreEqual(testArtist.RecordLabel.Name, artist.RecordLabel.Name);
                Assert.AreEqual(testArtist.RecordLabel.TaxId, artist.RecordLabel.TaxId);
                Assert.AreEqual(testArtist.RecordLabel.Email, artist.RecordLabel.Email);
                Assert.AreEqual(testArtist.RecordLabel.Phone, artist.RecordLabel.Phone);
                Assert.IsNotNull(testArtist.RecordLabel.Address);
                Assert.AreEqual(testArtist.RecordLabel.Address.Street, artist.RecordLabel.Address.Street);
                Assert.AreEqual(testArtist.RecordLabel.Address.City, artist.RecordLabel.Address.City);
                Assert.AreEqual(testArtist.RecordLabel.Address.Region, artist.RecordLabel.Address.Region);
                Assert.AreEqual(testArtist.RecordLabel.Address.PostalCode, artist.RecordLabel.Address.PostalCode);
                Assert.IsNotNull(testArtist.RecordLabel.Address.Country);
                Assert.AreEqual(testArtist.RecordLabel.Address.Country.Name, artist.RecordLabel.Address.Country.Name);
                Assert.AreEqual(testArtist.RecordLabel.Address.Country.IsoCode, artist.RecordLabel.Address.Country.IsoCode);
            }

            var removeArtistTask = new RemoveArtist(DbContext);
            var removeResult     = removeArtistTask.DoTask(artist);

            Assert.IsTrue(removeResult.Success);
            Assert.IsNull(removeResult.Exception);
        }