Exemplo n.º 1
0
        public void ApplyOverrides_WithNullConventions_ShouldReturnEqualInstance()
        {
            var domainEventsConventions = new DomainEventConventions(new BaseTypes(new TypeName[] {}));
            var commandConventions      = new CommandConventions(new BaseTypes(new TypeName[] {}));
            var instance = new ConventionsDeclaration(domainEventsConventions, commandConventions);

            var actual = instance.ApplyOverridesFrom(new ConventionsDeclaration(null, null));

            Assert.That(actual, Is.EqualTo(instance));
        }
Exemplo n.º 2
0
        public void EqualityMethods()
        {
            var baseTypes = new BaseTypes(new[] { new TypeName("SomeNamespace.IContract") });
            var anotherContractBaseTypes = new BaseTypes(new[] { new TypeName("SomeNamespace.IAnotherContract") });

            var a = new CommandConventions(baseTypes);
            var b = new CommandConventions(baseTypes);
            var c = new CommandConventions(baseTypes);

            var otherBaseTypes = new CommandConventions(anotherContractBaseTypes);

            EqualityTesting.TestEqualsAndGetHashCode(a, b, c, otherBaseTypes);
            EqualityTesting.TestEqualityOperators(a, b, c, otherBaseTypes);
        }
Exemplo n.º 3
0
        public static CodeTypeDeclaration CreateCommandDeclaration(
            SemanticModel model, NamespaceName namespaceName,
            CommandDeclaration declaration,
            CommandConventions conventions)
        {
            var type = CreateTypeWithValueSemantics(
                ValueObjectSpecification.CreateClass(
                    namespaceName, declaration.Name,
                    declaration.Properties.ToArray(),
                    conventions.BaseTypes,
                    true, false),
                model.KnownTypes);

            return(type);
        }
Exemplo n.º 4
0
        public void ApplyOverrides_WithNewCommandConventions_ShouldReturnNewInstanceWithThese()
        {
            var domainEventsConventions = new DomainEventConventions(new BaseTypes(new TypeName[] { }));
            var commandConventions      = new CommandConventions(new BaseTypes(new TypeName[] { }));
            var instance = new ConventionsDeclaration(domainEventsConventions, commandConventions);

            var newCommandConventions = new CommandConventions(
                new BaseTypes(new[] { new TypeName("SomeNamespace.ICommand") }));

            var actual = instance.ApplyOverridesFrom(new ConventionsDeclaration(null, newCommandConventions));

            Assert.That(actual, Is.Not.SameAs(instance));
            Assert.That(actual.DomainEventConventions, Is.EqualTo(domainEventsConventions));
            Assert.That(actual.CommandConventions, Is.EqualTo(newCommandConventions));
        }
Exemplo n.º 5
0
        public void EqualityOperations()
        {
            var domainEventsConventions = new DomainEventConventions(new BaseTypes(new TypeName[] { }));
            var commandConventions      = new CommandConventions(new BaseTypes(new TypeName[] { }));

            var a = new ConventionsDeclaration(domainEventsConventions, commandConventions);
            var b = new ConventionsDeclaration(domainEventsConventions, commandConventions);
            var c = new ConventionsDeclaration(domainEventsConventions, commandConventions);

            var otherDomainEvents = new ConventionsDeclaration(
                new DomainEventConventions(new BaseTypes(new[] { new TypeName("Some.BaseType") })),
                commandConventions);
            var otherCommands = new ConventionsDeclaration(
                domainEventsConventions,
                new CommandConventions(new BaseTypes(new[] { new TypeName("Some.BaseType") })));

            EqualityTesting.TestEqualsAndGetHashCode(a, b, c, otherDomainEvents, otherCommands);
            EqualityTesting.TestEqualityOperators(a, b, c, otherDomainEvents, otherCommands);
        }