/// <summary>
        /// Creates the resource of the specified type and that belongs to the specified container.
        /// </summary>
        /// <returns>
        /// The object representing a resource of specified type and belonging to the specified container.
        /// </returns>
        /// <param name="containerName">The name of the entity set to which the resource belongs.</param><param name="fullTypeName">The full namespace-qualified type name of the resource.</param>
        public object CreateResource(string containerName, string fullTypeName)
        {
            if (Type.GetType(fullTypeName, true) != typeof(Product))
                throw new InvalidOperationException("Unexpected type for resource.");

            var resource = new Product();

            UnderlyingProductCollection.Add(resource);

            return resource;
        }
Ejemplo n.º 2
0
 public static void ShouldMatch(this Product actual, Product expected, string expectedName)
 {
     try
     {
         actual.Id.ShouldEqual(expected.Id);
         actual.Name.ShouldEqual(expectedName);
         actual.Price.ShouldEqual(expected.Price);
         actual.ReleaseDate.ShouldEqual(expected.ReleaseDate);
         actual.Rating.ShouldEqual(expected.Rating);
     }
     catch (SpecificationException e)
     {
         throw new SpecificationException("Expected the actual product matching to expected but it differs by:\n" + e.Message, e);
     }
 }
Ejemplo n.º 3
0
 public static void ShouldMatch(this Product actual, Product expected)
 {
     actual.ShouldMatch(expected, expected.Name);
 }