protected override void Validate(TraceValidator flow) { flow.Then <Db, Add> (c => { Assert.Equal(As <Blueprint>(c.Entity).Id, 0, "Id of property Entity of command 'Create blueprint' has invalid value"); Assert.Null(As <Blueprint>(c.Entity).ToyType, "ToyType of property Entity of command 'Create blueprint' must be null"); Assert.Equal(As <Blueprint>(c.Entity).ToyTypeId, 32, "ToyTypeId of property Entity of command 'Create blueprint' has invalid value"); Assert.Equal(c.EntityType, typeof(Blueprint), "property EntityType of command 'Create blueprint' has invalid value"); Assert.Equal(c.Annotation, @"Create blueprint", "Annotation has invalid value"); } ); flow.Then <Db, Relate> (c => { Assert.Equal(As <Blueprint>(c.Primary).Id, 0, "Id of property Primary of command 'Ensure association with toy type' has invalid value"); Assert.Null(As <Blueprint>(c.Primary).ToyType, "ToyType of property Primary of command 'Ensure association with toy type' must be null"); Assert.Equal(As <Blueprint>(c.Primary).ToyTypeId, 32, "ToyTypeId of property Primary of command 'Ensure association with toy type' has invalid value"); Assert.Equal(c.PrimaryType, typeof(Blueprint), "property PrimaryType of command 'Ensure association with toy type' has invalid value"); Assert.Equal(As <ToyType>(c.Secondary).Id, 32, "Id of property Secondary of command 'Ensure association with toy type' has invalid value"); Assert.Equal(As <ToyType>(c.Secondary).Name, @"test type2", "Name of property Secondary of command 'Ensure association with toy type' has invalid value"); Assert.Equal(c.SecondaryType, typeof(ToyType), "property SecondaryType of command 'Ensure association with toy type' has invalid value"); Assert.Equal(c.ForeignKeySpecifier, @"ToyType", "property ForeignKeySpecifier of command 'Ensure association with toy type' has invalid value"); Assert.Equal(c.Annotation, @"Ensure association with toy type", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Add> ( Add <MeasurementUnit>(x => { if (x.Name != @"Kilograms") { return(false); } if (x.ShortName != @"kG") { return(false); } return(true); }, @"create measurement unit 'Kilograms' (kG)"), Annotated(@"create measurement unit 'Kilograms' (kG)") ); flow.Then <Save>(); flow.Then <Update> ( Update <MeasurementUnit>(new Dictionary <String, Object>() { { @"Name", @"Kilo" }, { @"ShortName", @"kg" } }, @"") ); flow.Then <Save>(); flow.Then <DeletePk> ( DeleteByPK <MeasurementUnit>(@"remove measurement unit#109", 109), Annotated(@"remove measurement unit#109") ); flow.Then <Save>(); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Db, Add> (c => { Assert.Equal(As <MeasurementUnit>(c.Entity).Id, 0, "Id of property Entity of command 'create measurement unit 'Kilograms' (kG)' has invalid value"); Assert.Equal(As <MeasurementUnit>(c.Entity).ShortName, @"kG", "ShortName of property Entity of command 'create measurement unit 'Kilograms' (kG)' has invalid value"); Assert.Equal(As <MeasurementUnit>(c.Entity).Name, @"Kilograms", "Name of property Entity of command 'create measurement unit 'Kilograms' (kG)' has invalid value"); Assert.Equal(c.EntityType, typeof(MeasurementUnit), "property EntityType of command 'create measurement unit 'Kilograms' (kG)' has invalid value"); Assert.Equal(c.Annotation, @"create measurement unit 'Kilograms' (kG)", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, UpdatePk> (c => { Assert.Collection(c.KeyValues, "property KeyValues of command UpdatePk must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 29, "item #0 of property KeyValues of command UpdatePk has invalid value"); }); Assert.Equal(c.EntityType, typeof(MeasurementUnit), "property EntityType of command UpdatePk has invalid value"); Assert.Equal(c.UpdateValuesStringKeys.Count, 2, "property UpdateValuesStringKeys of command UpdatePk has invalid size"); Assert.Equal(c.UpdateValuesStringKeys[@"Name"], @"Kilo", "value for Name in property UpdateValuesStringKeys of command UpdatePk has invalid value"); Assert.Equal(c.UpdateValuesStringKeys[@"ShortName"], @"kg", "value for ShortName in property UpdateValuesStringKeys of command UpdatePk has invalid value"); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, DeletePk> (c => { Assert.Equal(c.EntityType, typeof(MeasurementUnit), "property EntityType of command 'remove measurement unit#29' has invalid value"); Assert.Collection(c.KeyValues, "property KeyValues of command 'remove measurement unit#29' must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 29, "item #0 of property KeyValues of command 'remove measurement unit#29' has invalid value"); }); Assert.Equal(c.Annotation, @"remove measurement unit#29", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Add> ( Add <MeasurementUnit>(x => { if (x.Name != @"Kilograms") { return(false); } if (x.ShortName != @"kG") { return(false); } return(true); }, @"create measurement unit 'Kilograms' (kG)"), Annotated(@"create measurement unit 'Kilograms' (kG)") ); flow.Then <Save>(); flow.Then <Update> ( Update <MeasurementUnit>(x => { if (x.Name != @"Kilo") { return(false); } if (x.ShortName != @"kg") { return(false); } if (x.Id != 42) { return(false); } return(true); }, @"") ); flow.Then <Save>(); flow.Then <DeletePk> ( DeleteByPK <MeasurementUnit>(@"remove measurement unit#42", 42), Annotated(@"remove measurement unit#42") ); flow.Then <Save>(); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Add> ( Add <ToyType>(x => { if (x.Name != @"test type") { return(false); } return(true); }, @"Create new toy type"), Annotated(@"Create new toy type") ); flow.Then <Save>(); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Db, Add> (c => { Assert.Equal(As <ToyType>(c.Entity).Id, 0, "Id of property Entity of command 'Create new toy type' has invalid value"); Assert.Equal(As <ToyType>(c.Entity).Name, @"test type2", "Name of property Entity of command 'Create new toy type' has invalid value"); Assert.Equal(c.EntityType, typeof(ToyType), "property EntityType of command 'Create new toy type' has invalid value"); Assert.Equal(c.Annotation, @"Create new toy type", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Add> ( Add <MeasurementUnit>(x => { if (x.Name != @"Kilograms") { return(false); } if (x.ShortName != @"kG") { return(false); } return(true); }, @"create measurement unit 'Kilograms' (kG)"), Annotated(@"create measurement unit 'Kilograms' (kG)") ); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Add> ( Add <Blueprint>(x => { if (x.ToyTypeId != 1002) { return(false); } return(true); }, @"Create blueprint"), Annotated(@"Create blueprint") ); flow.Then <Relate> ( Annotated(@"Ensure association with toy type") ); flow.Then <Save>(); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Db, Add> (c => { Assert.Equal(As <ToyType>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Equal(As <ToyType>(c.Entity).Name, @"Test Toy Type 1", "Name of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(ToyType), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"Create new toy type", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <ToyType>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Equal(As <ToyType>(c.Entity).Name, @"Test Toy Type 2", "Name of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(ToyType), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"Create new toy type", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <Blueprint>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Null(As <Blueprint>(c.Entity).ToyType, "ToyType of added entity must be null"); Assert.Equal(As <Blueprint>(c.Entity).ToyTypeId, 43, "ToyTypeId of added entity has invalid value"); Assert.Equal(As <Blueprint>(c.Entity).Name, @"test", "Name of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(Blueprint), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, UpdatePk> (c => { Assert.Collection(c.KeyValues, "primary key must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 7, "item #0 of primary key has invalid value"); }); Assert.Equal(c.EntityType, typeof(Blueprint), "type of entity to update has invalid value"); Assert.Equal(c.UpdateValuesStringKeys.Count, 1, "updated values has invalid size"); Assert.Equal(As <Int32>(c.UpdateValuesStringKeys[@"ToyTypeId"]), 44, "value for ToyTypeId in updated values has invalid value"); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, DeletePk> (c => { Assert.Equal(c.EntityType, typeof(Blueprint), "type of entity to delete has invalid value"); Assert.Collection(c.KeyValues, "primary key must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 7, "item #0 of primary key has invalid value"); }); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, DeletePk> (c => { Assert.Equal(c.EntityType, typeof(ToyType), "type of entity to delete has invalid value"); Assert.Collection(c.KeyValues, "primary key must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 43, "item #0 of primary key has invalid value"); }); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, DeletePk> (c => { Assert.Equal(c.EntityType, typeof(ToyType), "type of entity to delete has invalid value"); Assert.Collection(c.KeyValues, "primary key must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 44, "item #0 of primary key has invalid value"); }); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Add> ( Add <MeasurementUnit>(x => { if (x.Name != @"Kilograms") { return(false); } if (x.ShortName != @"kG") { return(false); } return(true); }, @"create measurement unit 'Kilograms' (kG)"), Annotated(@"create measurement unit 'Kilograms' (kG)") ); flow.Then <Save>(); flow.Then <Add> ( Add <Resource>(x => { if (x.MeasurementUnitId != 103) { return(false); } if (x.StockQuantity != 0) { return(false); } if (x.Name != @"resource1") { return(false); } return(true); }, @"new resource resource1"), Annotated(@"new resource resource1") ); flow.Then <Add> ( Add <Resource>(x => { if (x.MeasurementUnitId != 103) { return(false); } if (x.StockQuantity != 0) { return(false); } if (x.Name != @"resource2") { return(false); } return(true); }, @"new resource resource2"), Annotated(@"new resource resource2") ); flow.Then <Add> ( Add <Resource>(x => { if (x.MeasurementUnitId != 103) { return(false); } if (x.StockQuantity != 0) { return(false); } if (x.Name != @"resource3") { return(false); } return(true); }, @"new resource resource3"), Annotated(@"new resource resource3") ); flow.Then <Save>(); flow.Then <Add> ( Add <ResourceSupply>(x => { if (x.ItemsCount != 0) { return(false); } if (x.Status != ResourceSupplyStatus.Open) { return(false); } //if (x.CreationDate != new DateTime(2020, 8, 31, 6, 16, 5, 232, DateTimeKind.Utc)) return false; if (x.Name != @"Supply1") { return(false); } return(true); }, @"add resource supply"), Annotated(@"add resource supply") ); flow.Then <Relate>(); flow.Then <Add> ( Add <ResourceSupplyItem>(x => { if (x.Quantity != 10) { return(false); } if (x.ResourceSupplyId != 0) { return(false); } if (x.ResourceId != 181) { return(false); } return(true); }, @"add resource supply item"), Annotated(@"add resource supply item") ); flow.Then <Relate>(); flow.Then <Add> ( Add <ResourceSupplyItem>(x => { if (x.Quantity != 10) { return(false); } if (x.ResourceSupplyId != 0) { return(false); } if (x.ResourceId != 182) { return(false); } return(true); }, @"add resource supply item"), Annotated(@"add resource supply item") ); flow.Then <Relate>(); flow.Then <Add> ( Add <ResourceSupplyItem>(x => { if (x.Quantity != 10) { return(false); } if (x.ResourceSupplyId != 0) { return(false); } if (x.ResourceId != 183) { return(false); } return(true); }, @"add resource supply item"), Annotated(@"add resource supply item") ); flow.Then <Save>(); flow.Then <Sql> ( SqlCommand(@"UPDATE [r] SET [r].[ItemsCount] = (SELECT COUNT(*) FROM [ResourceSupplyItem] [item] WHERE [item].[ResourceSupplyId] = {0}) FROM [ResourceSupply] [r] "), SqlParameters(46) ); flow.Then <Save>(); flow.Then <Sql> ( SqlCommand(@" UPDATE [res] SET [res].[StockQuantity] = ([res].[StockQuantity] + [item].[Quantity]) FROM [Resource] [res] INNER JOIN [ResourceSupplyItem] [item] ON [item].[ResourceId] = [res].[Id] WHERE [item].[ResourceSupplyId] = {0} "), SqlParameters(46) ); flow.Then <Sql> ( SqlCommand(@"UPDATE [r] SET [r].[Status] = {0} FROM [ResourceSupply] [r] WHERE [r].[Id] = {1}"), SqlParameters(4, 46) ); flow.Then <Save>(); flow.TheEnd(); }
protected override void Validate(TraceValidator flow) { flow.Then <Db, Add> (c => { Assert.Equal(As <MeasurementUnit>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Equal(As <MeasurementUnit>(c.Entity).ShortName, @"kG", "ShortName of added entity has invalid value"); Assert.Equal(As <MeasurementUnit>(c.Entity).Name, @"Kilograms", "Name of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(MeasurementUnit), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"create measurement unit 'Kilograms' (kG)", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <Resource>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).Name, @"resource1", "Name of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).StockQuantity, 0, "StockQuantity of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).MeasurementUnitId, 55, "MeasurementUnitId of added entity has invalid value"); Assert.Null(As <Resource>(c.Entity).MeasurementUnit, "MeasurementUnit of added entity must be null"); Assert.Equal(c.EntityType, typeof(Resource), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"new resource resource1", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <Resource>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).Name, @"resource2", "Name of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).StockQuantity, 0, "StockQuantity of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).MeasurementUnitId, 55, "MeasurementUnitId of added entity has invalid value"); Assert.Null(As <Resource>(c.Entity).MeasurementUnit, "MeasurementUnit of added entity must be null"); Assert.Equal(c.EntityType, typeof(Resource), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"new resource resource2", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <Resource>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).Name, @"resource3", "Name of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).StockQuantity, 0, "StockQuantity of added entity has invalid value"); Assert.Equal(As <Resource>(c.Entity).MeasurementUnitId, 55, "MeasurementUnitId of added entity has invalid value"); Assert.Null(As <Resource>(c.Entity).MeasurementUnit, "MeasurementUnit of added entity must be null"); Assert.Equal(c.EntityType, typeof(Resource), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"new resource resource3", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <ResourceSupply>(c.Entity).Name, @"Supply1", "Name of added entity has invalid value"); Assert.Equal(As <ResourceSupply>(c.Entity).CreationDate, new DateTime(2022, 1, 11, 0, 27, 24, 967, DateTimeKind.Utc), "CreationDate of added entity has invalid value"); Assert.Equal(As <ResourceSupply>(c.Entity).Status, ResourceSupplyStatus.Open, "Status of added entity has invalid value"); Assert.Equal(As <ResourceSupply>(c.Entity).ItemsCount, 0, "ItemsCount of added entity has invalid value"); Assert.Equal(As <ResourceSupply>(c.Entity).Id, 0, "Id of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(ResourceSupply), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"add resource supply", "Annotation has invalid value"); } ); flow.Then <Db, Relate> (c => { Assert.Equal(As <ResourceSupplyItem>(c.Primary).ResourceId, 157, "ResourceId of property Primary of command Relate has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Primary).Resource, "Resource of property Primary of command Relate must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Primary).ResourceSupplyId, 0, "ResourceSupplyId of property Primary of command Relate has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Primary).ResourceSupply, "ResourceSupply of property Primary of command Relate must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Primary).Quantity, 10, "Quantity of property Primary of command Relate has invalid value"); Assert.Equal(c.PrimaryType, typeof(ResourceSupplyItem), "property PrimaryType of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Name, @"Supply1", "Name of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).CreationDate, new DateTime(2022, 1, 11, 0, 27, 24, 967, DateTimeKind.Utc), "CreationDate of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Status, ResourceSupplyStatus.Open, "Status of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).ItemsCount, 0, "ItemsCount of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Id, 0, "Id of property Secondary of command Relate has invalid value"); Assert.Equal(c.SecondaryType, typeof(ResourceSupply), "property SecondaryType of command Relate has invalid value"); Assert.Equal(c.ForeignKeySpecifier, @"ResourceSupply", "property ForeignKeySpecifier of command Relate has invalid value"); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <ResourceSupplyItem>(c.Entity).ResourceId, 157, "ResourceId of added entity has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Entity).Resource, "Resource of added entity must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Entity).ResourceSupplyId, 0, "ResourceSupplyId of added entity has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Entity).ResourceSupply, "ResourceSupply of added entity must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Entity).Quantity, 10, "Quantity of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(ResourceSupplyItem), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"add resource supply item", "Annotation has invalid value"); } ); flow.Then <Db, Relate> (c => { Assert.Equal(As <ResourceSupplyItem>(c.Primary).ResourceId, 158, "ResourceId of property Primary of command Relate has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Primary).Resource, "Resource of property Primary of command Relate must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Primary).ResourceSupplyId, 0, "ResourceSupplyId of property Primary of command Relate has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Primary).ResourceSupply, "ResourceSupply of property Primary of command Relate must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Primary).Quantity, 10, "Quantity of property Primary of command Relate has invalid value"); Assert.Equal(c.PrimaryType, typeof(ResourceSupplyItem), "property PrimaryType of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Name, @"Supply1", "Name of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).CreationDate, new DateTime(2022, 1, 11, 0, 27, 24, 967, DateTimeKind.Utc), "CreationDate of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Status, ResourceSupplyStatus.Open, "Status of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).ItemsCount, 0, "ItemsCount of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Id, 0, "Id of property Secondary of command Relate has invalid value"); Assert.Equal(c.SecondaryType, typeof(ResourceSupply), "property SecondaryType of command Relate has invalid value"); Assert.Equal(c.ForeignKeySpecifier, @"ResourceSupply", "property ForeignKeySpecifier of command Relate has invalid value"); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <ResourceSupplyItem>(c.Entity).ResourceId, 158, "ResourceId of added entity has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Entity).Resource, "Resource of added entity must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Entity).ResourceSupplyId, 0, "ResourceSupplyId of added entity has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Entity).ResourceSupply, "ResourceSupply of added entity must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Entity).Quantity, 10, "Quantity of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(ResourceSupplyItem), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"add resource supply item", "Annotation has invalid value"); } ); flow.Then <Db, Relate> (c => { Assert.Equal(As <ResourceSupplyItem>(c.Primary).ResourceId, 159, "ResourceId of property Primary of command Relate has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Primary).Resource, "Resource of property Primary of command Relate must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Primary).ResourceSupplyId, 0, "ResourceSupplyId of property Primary of command Relate has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Primary).ResourceSupply, "ResourceSupply of property Primary of command Relate must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Primary).Quantity, 10, "Quantity of property Primary of command Relate has invalid value"); Assert.Equal(c.PrimaryType, typeof(ResourceSupplyItem), "property PrimaryType of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Name, @"Supply1", "Name of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).CreationDate, new DateTime(2022, 1, 11, 0, 27, 24, 967, DateTimeKind.Utc), "CreationDate of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Status, ResourceSupplyStatus.Open, "Status of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).ItemsCount, 0, "ItemsCount of property Secondary of command Relate has invalid value"); Assert.Equal(As <ResourceSupply>(c.Secondary).Id, 0, "Id of property Secondary of command Relate has invalid value"); Assert.Equal(c.SecondaryType, typeof(ResourceSupply), "property SecondaryType of command Relate has invalid value"); Assert.Equal(c.ForeignKeySpecifier, @"ResourceSupply", "property ForeignKeySpecifier of command Relate has invalid value"); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Add> (c => { Assert.Equal(As <ResourceSupplyItem>(c.Entity).ResourceId, 159, "ResourceId of added entity has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Entity).Resource, "Resource of added entity must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Entity).ResourceSupplyId, 0, "ResourceSupplyId of added entity has invalid value"); Assert.Null(As <ResourceSupplyItem>(c.Entity).ResourceSupply, "ResourceSupply of added entity must be null"); Assert.Equal(As <ResourceSupplyItem>(c.Entity).Quantity, 10, "Quantity of added entity has invalid value"); Assert.Equal(c.EntityType, typeof(ResourceSupplyItem), "type of added entity has invalid value"); Assert.Equal(c.Annotation, @"add resource supply item", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Sql> (c => { Assert.Equal(c.QueryText, @"UPATE [r] SET [r].[ItemsCount] = (SELECT COUNT(*) FROM [ResourceSupplyItem] [item] WHERE [item].[ResourceSupplyId] = {0}) FROM [ResourceSupply] [r]", "query text has invalid value"); Assert.Collection(c.QueryParameters, "query parameters collection must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 22, "item #0 of query parameters collection has invalid value"); }); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Sql> (c => { Assert.Equal(c.QueryText, @"UPDATE [res] SET [res].[StockQuantity] = ([res].[StockQuantity] + [item].[Quantity]) FROM [Resource] [res] INNER JOIN [ResourceSupplyItem] [item] ON [item].[ResourceId] = [res].[Id] WHERE [item].[ResourceSupplyId] = {0}", "query text has invalid value"); Assert.Collection(c.QueryParameters, "query parameters collection must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 22, "item #0 of query parameters collection has invalid value"); }); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <Db, Sql> (c => { Assert.Equal(c.QueryText, @"UPDATE [r] SET [r].[Status] = {0} FROM [ResourceSupply] [r] WHERE [r].[Id] = {1}", "query text has invalid value"); Assert.Collection(c.QueryParameters, "query parameters collection must be composed correctly", r0_0 => { Assert.Equal(As <Int32>(r0_0), 4, "item #0 of query parameters collection has invalid value"); }, r0_0 => { Assert.Equal(As <Int32>(r0_0), 22, "item #0 of query parameters collection has invalid value"); }); Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.Then <NoChannel, Save> (c => { Assert.Equal(c.Annotation, @"", "Annotation has invalid value"); } ); flow.TheEnd(); }