Esempio n. 1
0
        public void TaskSuccessTest()
        {
            var addArtistTask   = new AddArtist(DbContext, new FormattingService());
            var testArtist      = TestsModel.Artist;
            var addArtistResult = addArtistTask.DoTask(testArtist);

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

            var artistId = addArtistResult.Data;

            Assert.IsNotNull(artistId);
            Assert.IsTrue(artistId > 0);

            var paymentService = new ListServices(DbContext).DoTask(null).Data.SingleOrDefault(s => s.Name.ToLower() == "payment");

            Assert.IsNotNull(paymentService);

            var allPlatforms  = new ListPlatforms(DbContext).DoTask(null).Data.ToList();
            var linkPlatforms = new List <Platform>();

            foreach (var platform in allPlatforms)
            {
                linkPlatforms.AddRange(from service in platform.Services where service.Id != paymentService.Id select platform);
            }

            var linkPlatform = linkPlatforms[new Random().Next(0, linkPlatforms.Count)];

            var artistLink = new ArtistLink
            {
                Platform = linkPlatform,
                Artist   = testArtist,
                Url      = "http://www." + DateTime.Now.Ticks + ".com"
            };

            var task   = new AddArtistLink(DbContext);
            var result = task.DoTask(artistLink);

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

            var getArtistLinkTask   = new GetArtistLink(DbContext);
            var getArtistLinkResult = getArtistLinkTask.DoTask(artistLink.Id);

            Assert.IsTrue(getArtistLinkResult.Success);
            Assert.IsNull(getArtistLinkResult.Exception);
            Assert.IsNotNull(getArtistLinkResult.Data);

            Assert.AreEqual(artistLink.PlatformId, getArtistLinkResult.Data.PlatformId);
            Assert.AreEqual(artistLink.ArtistId, getArtistLinkResult.Data.ArtistId);
            Assert.AreEqual(artistLink.Url, getArtistLinkResult.Data.Url);

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

            Assert.IsTrue(removeArtistResult.Success);
            Assert.IsNull(removeArtistResult.Exception);
        }
Esempio n. 2
0
        public void TaskFailTest()
        {
            var task   = new AddArtist(EmptyDbContext, new FormattingService());
            var result = task.DoTask(new Artist());

            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);
        }
        public void TaskSuccessTest()
        {
            var addArtistTask   = new AddArtist(DbContext, new FormattingService());
            var testArtist      = TestsModel.Artist;
            var addArtistResult = addArtistTask.DoTask(testArtist);

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

            var artistId = addArtistResult.Data;

            Assert.IsNotNull(artistId);
            Assert.IsTrue(artistId > 0);

            var addPersonTask   = new AddPerson(DbContext, new FormattingService());
            var testPerson      = TestsModel.Person;
            var addPersonResult = addPersonTask.DoTask(testPerson);

            Assert.IsTrue(addPersonResult.Success);
            Assert.IsNull(addPersonResult.Exception);
            Assert.IsNotNull(addPersonResult.Data);

            var memberPerson = testPerson;
            var artistMember = new ArtistMember
            {
                Artist    = testArtist,
                Member    = memberPerson,
                StartedOn = DateTime.Now.AddMonths(-14)
            };

            var task   = new AddArtistMember(DbContext);
            var result = task.DoTask(artistMember);

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

            var listArtistMembersTask   = new ListArtistMembers(DbContext);
            var listArtistMembersResult = listArtistMembersTask.DoTask(testArtist);

            Assert.IsTrue(listArtistMembersResult.Success);
            Assert.IsNull(listArtistMembersResult.Exception);
            Assert.IsNotNull(listArtistMembersResult.Data);

            var member = listArtistMembersResult.Data.SingleOrDefault(m => m.Id == artistMember.Id);

            Assert.IsNotNull(member);
            Assert.AreEqual(artistMember.StartedOn, member.StartedOn);
            Assert.AreEqual(artistMember.EndedOn, member.EndedOn);
            Assert.AreEqual(artistMember.IsActive, member.IsActive);

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

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

            var removePersonTask   = new RemovePerson(DbContext);
            var removePersonResult = removePersonTask.DoTask(memberPerson);

            Assert.IsTrue(removePersonResult.Success);
            Assert.IsNull(removePersonResult.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 paymentService = new ListServices(DbContext).DoTask(null).Data.SingleOrDefault(s => s.Name.ToLower() == "payment");

            Assert.IsNotNull(paymentService);

            var allPlatforms     = new ListPlatforms(DbContext).DoTask(null).Data.ToList();
            var paymentPlatforms = new List <Platform>();

            foreach (var platform in allPlatforms)
            {
                paymentPlatforms.AddRange(from service in platform.Services where service.Id == paymentService.Id select platform);
            }

            var paymentPlatform = paymentPlatforms[new Random().Next(0, paymentPlatforms.Count)];

            var artistAccount = new ArtistAccount
            {
                IsPreferred = true,
                Platform    = paymentPlatform,
                Artist      = testArtist,
                Username    = "******" + DateTime.Now.Ticks
            };

            var addArtistAccountTask   = new AddArtistAccount(DbContext);
            var addArtistAccountResult = addArtistAccountTask.DoTask(artistAccount);

            Assert.IsTrue(addArtistAccountResult.Success);
            Assert.IsNull(addArtistAccountResult.Exception);
            Assert.IsNotNull(addArtistAccountResult.Data);

            var getArtistAccountTask   = new GetArtistAccount(DbContext);
            var getArtistAccountResult = getArtistAccountTask.DoTask(artistAccount.Id);

            Assert.IsTrue(getArtistAccountResult.Success);
            Assert.IsNull(getArtistAccountResult.Exception);
            Assert.IsNotNull(getArtistAccountResult.Data);

            Assert.AreEqual(artistAccount.PlatformId, getArtistAccountResult.Data.PlatformId);
            Assert.AreEqual(artistAccount.ArtistId, getArtistAccountResult.Data.ArtistId);
            Assert.AreEqual(artistAccount.IsPreferred, getArtistAccountResult.Data.IsPreferred);
            Assert.AreEqual(artistAccount.Username, getArtistAccountResult.Data.Username);

            artistAccount.Username    = "******" + DateTime.Now.Ticks;
            artistAccount.IsPreferred = false;

            var task   = new UpdateArtistAccount(DbContext);
            var result = task.DoTask(artistAccount);

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

            getArtistAccountTask   = new GetArtistAccount(DbContext);
            getArtistAccountResult = getArtistAccountTask.DoTask(artistAccount.Id);
            Assert.AreEqual(artistAccount.PlatformId, getArtistAccountResult.Data.PlatformId);
            Assert.AreEqual(artistAccount.ArtistId, getArtistAccountResult.Data.ArtistId);
            Assert.AreEqual(artistAccount.IsPreferred, getArtistAccountResult.Data.IsPreferred);
            Assert.AreEqual(artistAccount.Username, getArtistAccountResult.Data.Username);

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

            Assert.IsTrue(removeArtistResult.Success);
            Assert.IsNull(removeArtistResult.Exception);
        }
Esempio n. 7
0
        public void TaskSuccessTest()
        {
            var addArtist     = new AddArtist(DbContext, new FormattingService());
            var testArtist1   = TestsModel.Artist;
            var testArtist1Id = addArtist.DoTask(testArtist1);

            Assert.IsTrue(testArtist1Id.Data.HasValue);
            addArtist = new AddArtist(DbContext, new FormattingService());
            var testArtist2   = TestsModel.Artist;
            var testArtist2Id = addArtist.DoTask(testArtist2);

            Assert.IsTrue(testArtist2Id.Data.HasValue);

            var task   = new ListArtists(DbContext);
            var result = task.DoTask(null);

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

            var artists = result.Data;

            Assert.IsNotNull(artists);
            Assert.IsTrue(artists.Count >= 2);

            var artist1 = artists.SingleOrDefault(a => a.Id == testArtist1Id.Data.Value);

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

            var artist2 = artists.SingleOrDefault(a => a.Id == testArtist2Id.Data.Value);

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

            var removeArtist  = new RemoveArtist(DbContext);
            var removeResult1 = removeArtist.DoTask(artist1);
            var removeResult2 = removeArtist.DoTask(artist2);

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

            Assert.IsTrue(removeResult2.Success);
            Assert.IsNull(removeResult2.Exception);
        }
Esempio n. 8
0
        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 artistId = addArtistResult.Data;

            Assert.IsNotNull(artistId);
            Assert.IsTrue(artistId > 0);

            var addPersonTask   = new AddPerson(DbContext, new FormattingService());
            var testPerson      = TestsModel.Person;
            var addPersonResult = addPersonTask.DoTask(testPerson);

            Assert.IsTrue(addPersonResult.Success);
            Assert.IsNull(addPersonResult.Exception);
            Assert.IsNotNull(addPersonResult.Data);

            var managerPerson = testPerson;
            var artistManager = new ArtistManager
            {
                Artist    = testArtist,
                Manager   = managerPerson,
                StartedOn = DateTime.Now.AddMonths(-8)
            };

            var addArtistManagerTask   = new AddArtistManager(DbContext);
            var addArtistManagerResult = addArtistManagerTask.DoTask(artistManager);

            Assert.IsTrue(addArtistManagerResult.Success);
            Assert.IsNull(addArtistManagerResult.Exception);
            Assert.IsNotNull(addArtistManagerResult.Data);

            var getArtistManagerTask   = new GetArtistManager(DbContext);
            var getArtistManagerResult = getArtistManagerTask.DoTask(artistManager.Id);

            Assert.IsTrue(getArtistManagerResult.Success);
            Assert.IsNull(getArtistManagerResult.Exception);
            Assert.IsNotNull(getArtistManagerResult.Data);

            var manager = getArtistManagerResult.Data;

            Assert.IsNotNull(manager);
            Assert.AreEqual(artistManager.StartedOn, manager.StartedOn);
            Assert.AreEqual(artistManager.EndedOn, manager.EndedOn);
            Assert.AreEqual(artistManager.IsActive, manager.IsActive);

            manager.EndedOn = DateTime.Now.AddDays(-1);

            var task   = new UpdateArtistManager(DbContext);
            var result = task.DoTask(manager);

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

            getArtistManagerTask   = new GetArtistManager(DbContext);
            getArtistManagerResult = getArtistManagerTask.DoTask(artistManager.Id);

            Assert.IsTrue(getArtistManagerResult.Success);
            Assert.IsNull(getArtistManagerResult.Exception);
            Assert.IsNotNull(getArtistManagerResult.Data);

            var updatedManager = getArtistManagerResult.Data;

            Assert.IsNotNull(updatedManager);
            Assert.AreEqual(manager.StartedOn, updatedManager.StartedOn);
            Assert.AreEqual(manager.EndedOn, updatedManager.EndedOn);
            Assert.AreEqual(false, updatedManager.IsActive);

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

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

            var removePersonTask   = new RemovePerson(DbContext);
            var removePersonResult = removePersonTask.DoTask(managerPerson);

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

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

            var artistId = addArtistResult.Data;

            Assert.IsNotNull(artistId);
            Assert.IsTrue(artistId > 0);

            var paymentService = new ListServices(DbContext).DoTask(null).Data.SingleOrDefault(s => s.Name.ToLower() == "payment");

            Assert.IsNotNull(paymentService);

            var allPlatforms     = new ListPlatforms(DbContext).DoTask(null).Data.ToList();
            var paymentPlatforms = new List <Platform>();

            foreach (var platform in allPlatforms)
            {
                paymentPlatforms.AddRange(from service in platform.Services where service.Id == paymentService.Id select platform);
            }

            foreach (var paymentPlatform in paymentPlatforms)
            {
                var artistAccount = new ArtistAccount
                {
                    IsPreferred = new Random().Next(0, 2) == 0,
                    Platform    = paymentPlatform,
                    Artist      = testArtist,
                    Username    = "******" + new Random().Next(100, 999)
                };
                var addArtistAccountTask   = new AddArtistAccount(DbContext);
                var addArtistAccountResult = addArtistAccountTask.DoTask(artistAccount);

                Assert.IsTrue(addArtistAccountResult.Success);
                Assert.IsNull(addArtistAccountResult.Exception);
                Assert.IsNotNull(addArtistAccountResult.Data);
            }

            var task   = new ListArtistAccounts(DbContext);
            var result = task.DoTask(testArtist);

            Assert.IsTrue(result.Success);
            Assert.IsNull(result.Exception);
            Assert.IsNotNull(result.Data);
            Assert.AreEqual(paymentPlatforms.Count, result.Data.Count);

            foreach (var userAccount in result.Data)
            {
                Assert.AreEqual(userAccount.ArtistId, testArtist.Id);
                Assert.IsNotNull(userAccount.Username);
            }

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

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