public void DatabaseQueryBuilderCreate() { var provider = new Mock<MockedContextProvider>(); var container = new QueryPartsContainer() as IQueryPartsContainer; var builder = new TableQueryBuilder<Warrior, MockedContextProvider>(provider.Object, container); // Act builder.Create(); Assert.IsTrue(container.Parts.Any(p => p.OperationType == OperationType.CreateTable)); var part = container.Parts.First(p => p.OperationType == OperationType.CreateTable); Assert.IsNotNull(part); Assert.IsTrue(part.Parts.Count(p => p.OperationType == OperationType.Column) == 5); }
public void DatabaseQueryBuilderCreateWithNonEmptyContainer() { var provider = new Mock<MockedContextProvider>(); var container = new QueryPartsContainer() as IQueryPartsContainer; container.Add(new DelegateQueryPart(OperationType.Column, () => string.Empty, typeof(Warrior), "Name")); var builder = new TableQueryBuilder<Warrior, MockedContextProvider>(provider.Object, container); // Act builder.Create(); Assert.IsTrue(container.Parts.Any(p => p.OperationType == OperationType.CreateTable)); var part = container.Parts.First(p => p.OperationType == OperationType.CreateTable); Assert.IsNotNull(part); Assert.IsTrue(part.Parts.Count(p => p.OperationType == OperationType.Column) == 5); }