/// <summary>
        /// Defines an import for the group with the given insert point and the given imports that should be satisfied.
        /// </summary>
        /// <param name="contractName">The contract name for the group import.</param>
        /// <param name="insertPoint">The point at which the imported schedule will be placed in the group schedule.</param>
        /// <param name="importsToSatisfy">The imports that should be satisfied.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="contractName"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     Thrown if <paramref name="contractName"/> is an empty string.
        /// </exception>
        /// <exception cref="DuplicateContractNameException">
        ///     Thrown if <paramref name="contractName"/> already exists in the collection of imports.
        /// </exception>
        public void DefineImport(string contractName, InsertVertex insertPoint, IEnumerable <ImportRegistrationId> importsToSatisfy)
        {
            if (m_GroupImports.ContainsKey(contractName))
            {
                throw new DuplicateContractNameException();
            }

            var import = new GroupImportMap(contractName, insertPoint, importsToSatisfy);

            m_GroupImports.Add(contractName, import);
        }
        public void EqualsWithUnequalObjectTypes()
        {
            var first = new GroupImportMap(
                "c",
                new InsertVertex(1),
                new List <ImportRegistrationId>
            {
                new ImportRegistrationId(typeof(string), 0, "aa")
            });
            var second = new object();

            Assert.IsFalse(first.Equals(second));
        }
        public void EqualsOperatorWithFirstObjectNull()
        {
            GroupImportMap first  = null;
            var            second = new GroupImportMap(
                "c",
                new InsertVertex(1),
                new List <ImportRegistrationId>
            {
                new ImportRegistrationId(typeof(string), 0, "aa")
            });

            Assert.IsFalse(first == second);
        }
        public void RoundtripSerialize()
        {
            var original = new GroupImportMap(
                "c",
                new InsertVertex(1),
                new List <ImportRegistrationId>
            {
                new ImportRegistrationId(typeof(string), 0, "aa")
            });
            var copy = AssertExtensions.RoundTripSerialize(original);

            Assert.AreEqual(original, copy);
        }
        public void Create()
        {
            var name         = "a";
            var insertVertex = new InsertVertex(1);
            var imports      = new List <ImportRegistrationId>
            {
                new ImportRegistrationId(typeof(string), 0, "aa")
            };
            var obj = new GroupImportMap(name, insertVertex, imports);

            Assert.AreEqual(name, obj.ContractName);
            Assert.AreEqual(insertVertex, obj.InsertPoint);
            Assert.That(obj.ObjectImports, Is.EquivalentTo(imports));
        }
        public void EqualsWithEqualObjects()
        {
            var first = new GroupImportMap(
                "c",
                new InsertVertex(1),
                new List <ImportRegistrationId>
            {
                new ImportRegistrationId(typeof(string), 0, "aa")
            });
            object second = new GroupImportMap(
                "c",
                new InsertVertex(2),
                new List <ImportRegistrationId>
            {
                new ImportRegistrationId(typeof(string), 1, "aa")
            });

            Assert.IsTrue(first.Equals(second));
        }