/// <summary>
        /// Build a mockup for a storage type.
        /// </summary>
        /// <returns>Mockup for a storage type.</returns>
        public static IStorageType BuildStorageTypeMock(Guid?storageTypeIdentifier = null, int?sortOrder = null)
        {
            Guid identifier = storageTypeIdentifier ?? Guid.NewGuid();

            IStorageType storageType = MockRepository.GenerateMock <IStorageType>();

            storageType.Stub(m => m.Identifier)
            .Return(identifier)
            .Repeat.Any();
            storageType.Stub(m => m.SortOrder)
            .Return(sortOrder ?? Fixture.Create <int>())
            .Repeat.Any();
            storageType.Stub(m => m.Temperature)
            .Return(Fixture.Create <int>())
            .Repeat.Any();
            storageType.Stub(m => m.TemperatureRange)
            .Return(BuildIntRange())
            .Repeat.Any();
            storageType.Stub(m => m.Creatable)
            .Return(Fixture.Create <bool>())
            .Repeat.Any();
            storageType.Stub(m => m.Editable)
            .Return(Fixture.Create <bool>())
            .Repeat.Any();
            storageType.Stub(m => m.Deletable)
            .Return(Fixture.Create <bool>())
            .Repeat.Any();
            storageType.Stub(m => m.Translation)
            .Return(BuildTranslationMock(identifier))
            .Repeat.Any();
            storageType.Stub(m => m.Translations)
            .Return(BuildTranslationMockCollection(identifier))
            .Repeat.Any();
            return(storageType);
        }
Beispiel #2
0
        /// <summary>
        /// Builds a mockup for a storage type which can be used for unit testing.
        /// </summary>
        /// <returns>Mockup for a storage type which can be used for unit testing.</returns>
        private IStorageType BuildStorageTypeMock(Guid storageTypeIdentifier, bool?creatable = null, bool?deletable = null)
        {
            IStorageType storageTypeMock = MockRepository.GenerateMock <IStorageType>();

            storageTypeMock.Stub(m => m.Identifier)
            .Return(storageTypeIdentifier)
            .Repeat.Any();
            storageTypeMock.Stub(m => m.Creatable)
            .Return(creatable ?? _fixture.Create <bool>())
            .Repeat.Any();
            storageTypeMock.Stub(m => m.Deletable)
            .Return(deletable ?? _fixture.Create <bool>())
            .Repeat.Any();
            return(storageTypeMock);
        }