using Chauffeur.TestingTools; using Fluidity.Configuration; using Fluidity.Data; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Umbraco.Core; using Xunit; namespace FluidityTests { public class DemoTests : UmbracoHostTestBase { private readonly DefaultFluidityRepository fluidityRepo; public DemoTests() { Host.Run(new[] { "install y" }).Wait(); ApplicationContext.Current.DatabaseContext.Database.Execute(@" CREATE TABLE [Person] ( [Id] int IDENTITY (1,1) NOT NULL, [Name] nvarchar(255) NOT NULL );"); fluidityRepo = new DefaultFluidityRepository( new FluidityCollectionConfig( p => p.Id, "Person", "People", "Them people" ) ); } [Fact] public void Can_Create_A_Person() { var person = new Person { Name = "Aaron Powell" }; Fluidity.Fluidity.SavingEntity += (sender, args) => { Assert.Null(args.Entity.Before); Assert.Equal(person.Name, ((Person)args.Entity.After).Name); }; fluidityRepo.Save(person); var allPeople = fluidityRepo.GetAll(); Assert.Single(allPeople); } } }