public void List_ShouldReturn_CreatedTransfers() { Transfer createdTransfer1, createdTransfer2; IEnumerable <Transfer> queriedTransfers; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var categoriesController = new CategoriesController(dataLayer)) using (var currenciesController = new CurrenciesController(dataLayer)) using (var partnersController = new PartnersController(dataLayer)) using (var transfersController = new TransfersController(dataLayer)) { var category = categoriesController.CreateCategory(TestDataProvider.CreateNewCategory()); var partner = partnersController.CreatePartner(TestDataProvider.CreateNewPartner()); var currency = currenciesController.CreateCurrency(TestDataProvider.CreateNewCurrency()); var newTransfer1 = TestDataProvider.CreateNewTransfer( category.Id, partner.Id, currency.Id, TestDataProvider.CreateNewTransferItem()); createdTransfer1 = transfersController.CreateTransfer(newTransfer1); var newTransfer2 = TestDataProvider.CreateNewTransfer( category.Id, partner.Id, currency.Id, TestDataProvider.CreateNewTransferItem()); createdTransfer2 = transfersController.CreateTransfer(newTransfer2); queriedTransfers = transfersController.List(); } AssertTransfersInList(queriedTransfers, createdTransfer1, createdTransfer2); }
public void Should_CRUD_File_Successfully() { Events.MediaManagerEvents.Instance.MediaFileUploaded += Instance_EntityCreated; Events.MediaManagerEvents.Instance.MediaFileUpdated += Instance_EntityUpdated; Events.MediaManagerEvents.Instance.MediaFileDeleted += Instance_EntityDeleted; Events.MediaManagerEvents.Instance.MediaArchived += Instance_MediaArchived; Events.MediaManagerEvents.Instance.MediaUnarchived += Instance_MediaUnarchived; RunApiActionInTransaction( (api, session) => { category = null; var categoryTree = TestDataProvider.CreateNewCategoryTree(); category = TestDataProvider.CreateNewCategory(categoryTree); session.SaveOrUpdate(categoryTree); session.SaveOrUpdate(category); session.Flush(); Run(session, api.Media.Files.Post, api.Media.File.Get, api.Media.File.Put, api.Media.File.Delete); }); Assert.AreEqual(1, archivedMediaEventCount, "Archived media events fired count"); Assert.AreEqual(1, unarchivedMediaEventCount, "Unarchived media events fired count"); Events.MediaManagerEvents.Instance.MediaFileUploaded -= Instance_EntityCreated; Events.MediaManagerEvents.Instance.MediaFileUpdated -= Instance_EntityUpdated; Events.MediaManagerEvents.Instance.MediaFileDeleted -= Instance_EntityDeleted; Events.MediaManagerEvents.Instance.MediaArchived -= Instance_MediaArchived; Events.MediaManagerEvents.Instance.MediaUnarchived -= Instance_MediaUnarchived; }
public void Delete_Normally_ShouldWork() { Transfer createdTransfer, queriedTransfer; IEnumerable <Transfer> listedTransfers; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var categoriesController = new CategoriesController(dataLayer)) using (var currenciesController = new CurrenciesController(dataLayer)) using (var partnersController = new PartnersController(dataLayer)) using (var transfersController = new TransfersController(dataLayer)) { var category = categoriesController.CreateCategory(TestDataProvider.CreateNewCategory()); var partner = partnersController.CreatePartner(TestDataProvider.CreateAnotherNewPartner()); var currency = currenciesController.CreateCurrency(TestDataProvider.CreateAnotherNewCurrency()); var newTransfer = TestDataProvider.CreateNewTransfer( category.Id, partner.Id, currency.Id, TestDataProvider.CreateNewTransferItem()); createdTransfer = transfersController.CreateTransfer(newTransfer); queriedTransfer = transfersController.Get(createdTransfer.Id); transfersController.Delete(createdTransfer.Id); listedTransfers = transfersController.List(); } Assert.AreEqual(createdTransfer.Id, queriedTransfer.Id, "Unexpected ID."); Assert.AreEqual(false, listedTransfers.Any(), "There should be no transfers returned."); }
public void Get_Normally_ShouldReturn_TransferWithId() { CreatedAtActionResult actionResult; Transfer createdTransfer, queriedTransfer; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var categoriesController = new CategoriesController(dataLayer)) using (var currenciesController = new CurrenciesController(dataLayer)) using (var partnersController = new PartnersController(dataLayer)) using (var transfersController = new TransfersController(dataLayer)) { var category = categoriesController.CreateCategory(TestDataProvider.CreateNewCategory()); var partner = partnersController.CreatePartner(TestDataProvider.CreateAnotherNewPartner()); var currency = currenciesController.CreateCurrency(TestDataProvider.CreateNewCurrency()); var newTransfer = TestDataProvider.CreateNewTransfer( category.Id, partner.Id, currency.Id, TestDataProvider.CreateNewTransferItem()); actionResult = (CreatedAtActionResult)transfersController.Create(newTransfer); createdTransfer = (Transfer)actionResult.Value; queriedTransfer = transfersController.Get(createdTransfer.Id); } Assert.AreEqual(actionResult.ActionName, "Get"); Assert.IsTrue( queriedTransfer.IsEqualTo(createdTransfer), "The two transfers should be equal. " + $"Expected: {createdTransfer.Stringify()}, actual: {queriedTransfer.Stringify()}."); }
public void Create_WhenRecordExists_ShouldThrow() { using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CategoriesController(dataLayer)) { var newCategory = TestDataProvider.CreateNewCategory(); controller.Create(newCategory); controller.Create(newCategory); } }
protected override SaveServerControlWidgetModel GetCreateModel(ISession session) { var categoryTree = TestDataProvider.CreateNewCategoryTree(); var category = TestDataProvider.CreateNewCategory(categoryTree); categoryTree.AvailableFor = new List <CategoryTreeCategorizableItem> { new CategoryTreeCategorizableItem { // See Migration201502101136.cs CategorizableItem = session.Load <CategorizableItem>(new Guid("B2F05159-74AF-4B67-AEB9-36B9CC9EED57")), CategoryTree = categoryTree } }; session.SaveOrUpdate(categoryTree); session.SaveOrUpdate(category); session.Flush(); var content = TestDataProvider.CreateNewServerControlWidget(); session.SaveOrUpdate(content); session.Flush(); return(new SaveServerControlWidgetModel { Name = TestDataProvider.ProvideRandomString(MaxLength.Name), WidgetUrl = content.Url, PreviewUrl = content.PreviewUrl, IsPublished = true, PublishedOn = content.PublishedOn, PublishedByUser = content.PublishedByUser, Categories = new List <Guid> { category.Id }, Options = new List <OptionModel> { new OptionModel { DefaultValue = "1", Key = "K1", Type = OptionType.Text }, new OptionModel { DefaultValue = Guid.NewGuid().ToString(), Key = "K2", Type = OptionType.Custom, CustomTypeIdentifier = MediaManagerFolderOptionProvider.Identifier } } }); }
public void List_ShouldReturn_CreatedCategories() { Category createdCategory1, createdCategory2; IEnumerable <Category> queriedCategories; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CategoriesController(dataLayer)) { createdCategory1 = controller.CreateCategory(TestDataProvider.CreateNewCategory()); createdCategory2 = controller.CreateCategory(TestDataProvider.CreateAnotherNewCategory()); queriedCategories = controller.List(); } AssertCategoriesInList(queriedCategories, createdCategory1, createdCategory2); }
public void Update_Normally_ShouldWork() { Category createdCategory, updatedCategory; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CategoriesController(dataLayer)) { createdCategory = controller.CreateCategory(TestDataProvider.CreateNewCategory()); controller.Update(new CategoryUpdate { Id = createdCategory.Id, Name = "Cinema" }); updatedCategory = controller.Get(createdCategory.Id); } Assert.AreEqual("Cinema", updatedCategory.Name); }
public void Get_Normally_ShouldReturn_CategoryWithId() { Category createdCategory, queriedCategory; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CategoriesController(dataLayer)) { createdCategory = controller.CreateCategory(TestDataProvider.CreateNewCategory()); queriedCategory = controller.Get(createdCategory.Id); } Assert.IsTrue( queriedCategory.IsEqualTo(createdCategory), "The two categories should be equal. " + $"Expected: {createdCategory.Stringify()}, actual: {queriedCategory.Stringify()}."); }
public void Delete_Normally_ShouldWork() { Category createdCategory, queriedCategory; IEnumerable <Category> listedCategories; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CategoriesController(dataLayer)) { createdCategory = controller.CreateCategory(TestDataProvider.CreateNewCategory()); queriedCategory = controller.Get(createdCategory.Id); controller.Delete(createdCategory.Id); listedCategories = controller.List(); } Assert.AreEqual(createdCategory.Id, queriedCategory.Id, "Unexpected ID."); Assert.AreEqual(false, listedCategories.Any(), "There should be no categories returned."); }
public void Create_Normally_ShouldReturn_Category() { var newCategory = TestDataProvider.CreateNewCategory(); CreatedAtActionResult actionResult; Category category; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CategoriesController(dataLayer)) { actionResult = (CreatedAtActionResult)controller.Create(newCategory); category = (Category)actionResult.Value; } Assert.AreEqual(actionResult.ActionName, "Get"); Assert.IsTrue( category.Id > 0, $"Category ID is expected to greater than 0. Actual: {category.Id}."); Assert.AreEqual( newCategory.Name, category.Name, $"Invalid category name. Expected: \"{newCategory.Name}\", actual: \"{category.Name}\"."); }
public void Create_Normally_ShouldReturn_Transfer() { NewTransfer newTransfer; Transfer transfer; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var categoriesController = new CategoriesController(dataLayer)) using (var currenciesController = new CurrenciesController(dataLayer)) using (var partnersController = new PartnersController(dataLayer)) using (var transfersController = new TransfersController(dataLayer)) { var category = categoriesController.CreateCategory(TestDataProvider.CreateNewCategory()); var partner = partnersController.CreatePartner(TestDataProvider.CreateAnotherNewPartner()); var currency = currenciesController.CreateCurrency(TestDataProvider.CreateAnotherNewCurrency()); newTransfer = TestDataProvider.CreateNewTransfer( category.Id, partner.Id, currency.Id, TestDataProvider.CreateNewTransferItem()); transfer = transfersController.CreateTransfer(newTransfer); } Assert.AreEqual(newTransfer.CategoryId, transfer.Category.Id, "Unexpected category."); Assert.AreEqual(newTransfer.CurrencyId, transfer.Currency.Id, "Unexpected currency."); Assert.AreEqual(newTransfer.Discount, transfer.Discount, "Unexpected discount."); Assert.IsTrue(transfer.Id > 0, $"Transfer ID is expected to greater than 0. Actual: {transfer.Id}."); Assert.AreEqual(newTransfer.Items.Length, transfer.Items.Length, "Unexpected transfer item count."); Assert.AreEqual(newTransfer.Items[0].Discount, transfer.Items[0].Discount, "Unexpected item discount."); Assert.IsTrue( transfer.Items[0].Id > 0, $"Item ID is expected to greater than 0. Actual: {transfer.Items[0].Id}."); Assert.AreEqual(newTransfer.Items[0].Name, transfer.Items[0].Name, "Unexpected item name."); Assert.AreEqual(newTransfer.Items[0].Price, transfer.Items[0].Price, "Unexpected item price."); Assert.AreEqual(newTransfer.Note, transfer.Note, "Unexpected note."); Assert.AreEqual(newTransfer.PartnerId, transfer.Partner.Id, "Unexpected partner."); Assert.AreEqual(newTransfer.Time, transfer.Time, "Unexpected time."); Assert.AreEqual(newTransfer.Title, transfer.Title, "Unexpected title."); }
public void Should_Return_Categorys_List_Successfully() { BetterCms.Module.Root.Models.Category category1 = TestDataProvider.CreateNewCategory(); BetterCms.Module.Root.Models.Category category2 = TestDataProvider.CreateNewCategory(); Mock <IRepository> repositoryMock = new Mock <IRepository>(); repositoryMock .Setup(f => f.AsQueryable <BetterCms.Module.Root.Models.Category>()) .Returns(new[] { category1, category2 }.AsQueryable()); using (var api = new PagesApiContext(Container.BeginLifetimeScope(), repositoryMock.Object)) { var categories = api.GetCategories(); Assert.IsNotNull(categories); Assert.AreEqual(categories.Items.Count, 2); Assert.AreEqual(categories.TotalCount, 2); var category = categories.Items.FirstOrDefault(l => category1.Id == l.Id); Assert.IsNotNull(category); Assert.AreEqual(category1.Name, category.Name); } }
protected override SaveHtmlContentWidgetModel GetCreateModel(ISession session) { var categoryTree = TestDataProvider.CreateNewCategoryTree(); category = TestDataProvider.CreateNewCategory(categoryTree); categoryTree.AvailableFor = new List <CategoryTreeCategorizableItem> { new CategoryTreeCategorizableItem { // See Migration201502101136.cs CategorizableItem = session.Load <CategorizableItem>(new Guid("B2F05159-74AF-4B67-AEB9-36B9CC9EED57")), CategoryTree = categoryTree } }; session.SaveOrUpdate(categoryTree); session.SaveOrUpdate(category); session.Flush(); var widget = TestDataProvider.CreateNewHtmlContentWidget(); session.SaveOrUpdate(widget); var content = TestDataProvider.CreateNewHtmlContentWidget(); var language1 = TestDataProvider.CreateNewLanguage(); session.SaveOrUpdate(language1); var language2 = TestDataProvider.CreateNewLanguage(); session.SaveOrUpdate(language2); var assignmentId1 = Guid.NewGuid(); var assignmentId2 = Guid.NewGuid(); content.Html = string.Format("{0}{1}{3}{2}", TestDataProvider.ProvideRandomString(50), TestDataProvider.CreateChildWidgetAssignment(widget.Id, assignmentId1), TestDataProvider.ProvideRandomString(50), TestDataProvider.CreateChildWidgetAssignment(widget.Id, assignmentId2)); session.SaveOrUpdate(content); session.Flush(); return(new SaveHtmlContentWidgetModel { Name = TestDataProvider.ProvideRandomString(MaxLength.Name), IsPublished = true, PublishedOn = content.PublishedOn, PublishedByUser = content.PublishedByUser, Categories = new List <Guid>() { category.Id }, CustomCss = content.CustomCss, UseCustomCss = true, Html = content.Html, UseHtml = true, CustomJavaScript = content.CustomJs, UseCustomJavaScript = true, Options = new List <OptionModel> { new OptionModel { DefaultValue = "1", Key = "K1", Type = OptionType.Text, Translations = new List <OptionTranslationModel> { new OptionTranslationModel { LanguageId = language1.Id.ToString(), Value = "translated_lang1" }, new OptionTranslationModel { LanguageId = language2.Id.ToString(), Value = "translated_lang2" } } }, new OptionModel { DefaultValue = Guid.NewGuid().ToString(), Key = "K2", Type = OptionType.Custom, CustomTypeIdentifier = MediaManagerFolderOptionProvider.Identifier } }, ChildContentsOptionValues = new List <MultilingualChildContentOptionValuesModel> { new MultilingualChildContentOptionValuesModel { AssignmentIdentifier = assignmentId1, MultilingualOptionValues = new List <MultilingualOptionValueModel> { new MultilingualOptionValueModel { Key = "O1", Value = "V1", UseDefaultValue = false, Type = OptionType.Text, Translations = new List <OptionTranslationModel> { new OptionTranslationModel { LanguageId = language1.Id.ToString(), Value = "V1_translated_lang1" }, new OptionTranslationModel { LanguageId = language2.Id.ToString(), Value = "V1_translated_lang2" } } } } }, new MultilingualChildContentOptionValuesModel { AssignmentIdentifier = assignmentId2, MultilingualOptionValues = new List <MultilingualOptionValueModel> { new MultilingualOptionValueModel { Key = "O2", Value = Guid.NewGuid().ToString(), UseDefaultValue = false, Type = OptionType.Custom, CustomTypeIdentifier = "media-images-folder" }, new MultilingualOptionValueModel { Key = "O3", Value = Guid.NewGuid().ToString(), UseDefaultValue = true, Type = OptionType.Text } } } } }); }
protected override SavePagePropertiesModel GetCreateModel(ISession session) { var categoryTree = TestDataProvider.CreateNewCategoryTree(); var category = TestDataProvider.CreateNewCategory(categoryTree); var image = TestDataProvider.CreateNewMediaImage(); session.SaveOrUpdate(category); session.SaveOrUpdate(image); session.Flush(); session.Clear(); return(new SavePagePropertiesModel { Title = TestDataProvider.ProvideRandomString(MaxLength.Name), Tags = new[] { this.TestDataProvider.ProvideRandomString(MaxLength.Name), this.TestDataProvider.ProvideRandomString(MaxLength.Name) }, AccessRules = new[] { new AccessRuleModel { AccessLevel = AccessLevel.ReadWrite, Identity = TestDataProvider.ProvideRandomString(20), IsForRole = false }, new AccessRuleModel { AccessLevel = AccessLevel.Deny, Identity = TestDataProvider.ProvideRandomString(20), IsForRole = true } }, CustomCss = TestDataProvider.ProvideRandomString(MaxLength.Text), CustomJavaScript = TestDataProvider.ProvideRandomString(MaxLength.Text), Description = TestDataProvider.ProvideRandomString(MaxLength.Text), Categories = new List <Guid>() { category.Id }, FeaturedImageId = image.Id, IsArchived = false, IsMasterPage = false, IsPublished = true, LanguageGroupIdentifier = null, ForceAccessProtocol = ForceProtocolType.ForceHttps, LanguageId = null, LayoutId = layout != null ? layout.Id : (Guid?)null, MasterPageId = masterPage != null ? masterPage.Id : (Guid?)null, SecondaryImageId = image.Id, MainImageId = image.Id, MetaData = new MetadataModel { MetaTitle = TestDataProvider.ProvideRandomString(MaxLength.Name), MetaDescription = TestDataProvider.ProvideRandomString(MaxLength.Text), MetaKeywords = TestDataProvider.ProvideRandomString(MaxLength.Text) }, PageOptions = new List <OptionValueModel> { new OptionValueModel { DefaultValue = TestDataProvider.ProvideRandomString(100), Value = TestDataProvider.ProvideRandomString(100), Key = TestDataProvider.ProvideRandomString(100), Type = OptionType.Text, UseDefaultValue = false }, new OptionValueModel { DefaultValue = Guid.NewGuid().ToString(), Value = Guid.NewGuid().ToString(), Key = TestDataProvider.ProvideRandomString(100), Type = OptionType.Custom, CustomTypeIdentifier = MediaManagerFolderOptionProvider.Identifier, UseDefaultValue = false } }, PageUrl = string.Format("/{0}/", TestDataProvider.ProvideRandomString(200)), PublishedOn = TestDataProvider.ProvideRandomDateTime(), UseCanonicalUrl = TestDataProvider.ProvideRandomBooleanValue(), UseNoFollow = TestDataProvider.ProvideRandomBooleanValue(), UseNoIndex = TestDataProvider.ProvideRandomBooleanValue() }); }
public void Should_Swap_Original_And_Reuploaded_Entities_Correctly() { var original = TestDataProvider.CreateNewMediaFile(); var newVersion = TestDataProvider.CreateNewMediaFile(); var origTitle = original.Title; var newVersionTitle = newVersion.Title; var cat11 = TestDataProvider.CreateNewCategory(new CategoryTree()); var cat12 = TestDataProvider.CreateNewCategory(new CategoryTree()); var cat21 = TestDataProvider.CreateNewCategory(new CategoryTree()); var mcCat11 = new MediaCategory { Category = cat11, Media = original }; var mcCat12 = new MediaCategory { Category = cat12, Media = original }; var mcCat21 = new MediaCategory { Category = cat21, Media = newVersion }; var tag11 = TestDataProvider.CreateNewTag(); var tag12 = TestDataProvider.CreateNewTag(); var tag21 = TestDataProvider.CreateNewTag(); var mtTag11 = new MediaTag { Tag = tag11, Media = newVersion }; var mtTag12 = new MediaTag { Tag = tag12, Media = newVersion }; var mtTag21 = new MediaTag { Tag = tag21, Media = original }; original.Categories = new List <MediaCategory>(); newVersion.Categories = new List <MediaCategory>(); original.MediaTags = new List <MediaTag>(); newVersion.MediaTags = new List <MediaTag>(); original.Categories.Add(mcCat11); original.Categories.Add(mcCat12); newVersion.Categories.Add(mcCat21); newVersion.MediaTags.Add(mtTag11); newVersion.MediaTags.Add(mtTag12); original.MediaTags.Add(mtTag21); var service = GetMediaFileService(false); service.SwapOriginalMediaWithVersion(original, newVersion); // Ensure etity properies are switched Assert.AreNotEqual(original.Title, newVersion.Title); Assert.AreEqual(origTitle, newVersion.Title); Assert.AreEqual(newVersionTitle, original.Title); // Ensure original entity is set correctly Assert.AreEqual(newVersion.Original, original); // Ensure categories are switched correctly Assert.AreEqual(original.Categories.Count, 1); Assert.AreEqual(newVersion.Categories.Count, 2); Assert.IsTrue(newVersion.Categories.Contains(mcCat11)); Assert.IsTrue(newVersion.Categories.Contains(mcCat12)); Assert.IsTrue(original.Categories.Contains(mcCat21)); // Ensure tags are switched correctly Assert.AreEqual(original.MediaTags.Count, 2); Assert.AreEqual(newVersion.MediaTags.Count, 1); Assert.IsTrue(original.MediaTags.Contains(mtTag11)); Assert.IsTrue(original.MediaTags.Contains(mtTag12)); Assert.IsTrue(newVersion.MediaTags.Contains(mtTag21)); }
public void Should_Insert_And_Retrieve_Category_Successfully() { RunEntityMapTestsInTransaction(TestDataProvider.CreateNewCategory()); }
public void Update_Normally_ShouldWork() { Category category2; Transfer createdTransfer, updatedTransfer; TransferUpdate transferUpdate; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var categoriesController = new CategoriesController(dataLayer)) using (var currenciesController = new CurrenciesController(dataLayer)) using (var partnersController = new PartnersController(dataLayer)) using (var transfersController = new TransfersController(dataLayer)) { var category1 = categoriesController.CreateCategory(TestDataProvider.CreateNewCategory()); var partner = partnersController.CreatePartner(TestDataProvider.CreateNewPartner()); var currency = currenciesController.CreateCurrency(TestDataProvider.CreateAnotherNewCurrency()); category2 = categoriesController.CreateCategory(TestDataProvider.CreateAnotherNewCategory()); var newTransfer = TestDataProvider.CreateNewTransfer( category1.Id, partner.Id, currency.Id, TestDataProvider.CreateNewTransferItem()); createdTransfer = transfersController.CreateTransfer(newTransfer); transferUpdate = TestDataProvider.CreateTransferUpdate( createdTransfer.Id, category2.Id, partner.Id, currency.Id, TestDataProvider.CreateTransferItemUpdate(createdTransfer.Items[0].Id)); transfersController.Update(transferUpdate); updatedTransfer = transfersController.Get(createdTransfer.Id); } // Note that EF Core behaves slightly differently when an in-memory database is used, these checks are not // necessarily enough. Use "curl" or something similar, preferably a REST test-client to make sure // everything works as expected. Assert.IsTrue( updatedTransfer.Category.IsEqualTo(category2), $"Unexpected category. Expected: ${category2}. Actual: ${updatedTransfer.Category}."); Assert.IsTrue( updatedTransfer.Currency.IsEqualTo(createdTransfer.Currency), $"Unexpected currency. Expected: ${createdTransfer.Currency}. Actual: ${updatedTransfer.Currency}."); Assert.AreEqual(transferUpdate.Discount, updatedTransfer.Discount, "Unexpected discount."); Assert.AreEqual( transferUpdate.Items.Length, updatedTransfer.Items.Length, "Unexpected transfer item count."); Assert.AreEqual( transferUpdate.Items[0].Discount, updatedTransfer.Items[0].Discount, "Unexpected item discount."); Assert.AreEqual( createdTransfer.Items[0].Id, updatedTransfer.Items[0].Id, "Unexpected item ID"); Assert.AreEqual(transferUpdate.Items[0].Name, updatedTransfer.Items[0].Name, "Unexpected item name."); Assert.AreEqual(transferUpdate.Items[0].Price, updatedTransfer.Items[0].Price, "Unexpected item price."); Assert.AreEqual(transferUpdate.Note, updatedTransfer.Note, "Unexpected note."); Assert.IsTrue( updatedTransfer.Partner.IsEqualTo(createdTransfer.Partner), $"Unexpected partner. Expected: ${createdTransfer.Partner}. Actual: ${updatedTransfer.Partner}."); Assert.AreEqual(transferUpdate.Time, updatedTransfer.Time, "Unexpected time."); Assert.AreEqual(transferUpdate.Title, updatedTransfer.Title, "Unexpected title."); }