public void CreateType() { var id = new object(); var name = "name"; var @namespace = "namespace"; var attributes = (TypeAttributes)7; var baseType = ReflectionObjectMother.GetSomeType(); var fakeResult = MutableTypeObjectMother.Create(); _mutableTypeFactoryMock.Expect(mock => mock.CreateType(name, @namespace, attributes, baseType, null)).Return(fakeResult); var result = _context.CreateAdditionalType(id, name, @namespace, attributes, baseType); _mutableTypeFactoryMock.VerifyAllExpectations(); Assert.That(result, Is.SameAs(fakeResult)); Assert.That(_context.AdditionalTypes, Is.EqualTo(new[] { new KeyValuePair <object, MutableType> (id, result) })); }
public void CreateNestedType() { var typeName = "NestedType"; var @namespace = "namespace"; var declaringType = MutableTypeObjectMother.Create(@namespace: @namespace); var typeAttributes = TypeAttributes.NestedPublic; var baseType = ReflectionObjectMother.GetSomeType(); var mutableTypeFake = MutableTypeObjectMother.Create(); _mutableTypeFactoryMock.Expect(mock => mock.CreateType(typeName, @namespace, typeAttributes, baseType, declaringType)) .Return(mutableTypeFake); var result = _factory.CreateNestedType(declaringType, typeName, typeAttributes, baseType); _mutableTypeFactoryMock.VerifyAllExpectations(); Assert.That(result, Is.SameAs(mutableTypeFake)); }