Пример #1
0
        public MetadataBuilderTests()
        {
            const Behavior behavior = Behavior.Strict;

            var fixture = new Fixture();
            var key     = fixture.Create <string>();
            var value   = fixture.Create <string>();

            _localServerName                 = Environment.MachineName.ToLower();
            _ipAddressByServerName           = Mock.Create <IReadOnlyDictionary <string, string> >(behavior);
            _ipAddressByServerNameEnumerator = Mock.Create <IEnumerator <KeyValuePair <string, string> > >(behavior);
            _keyValuePair      = new KeyValuePair <string, string>(key, value);
            _ipAddress         = _keyValuePair.Value;
            _remoteServerNames = new List <string> {
                _keyValuePair.Key
            };
            _ping                  = Mock.Create <Ping>(behavior);
            _pingReply             = Mock.Create <PingReply>(behavior);
            _buffer                = new byte[0];
            _pingOptions           = new PingOptions(ttl: 64, dontFragment: true);
            _timeout               = 1;
            _configurationMetadata = Mock.Create <IConfigurationMetadata>(behavior);
            _pingCreator           = Mock.Create <IPingCreator>(behavior);
            _pingReplyEvaluator    = Mock.Create <IPingReplyEvaluator>(behavior);
            _testObject            = new MetadataBuilder(_configurationMetadata, _pingCreator, _pingReplyEvaluator);
        }
    public override int JustMockLite()
    {
        JustMock.Reset();
        var thing = JustMock.Create <IThing>();

        return(thing.Zero());
    }
    public override void JustMockLite()
    {
        JustMock.Reset();
        var thing = JustMock.Create <IThing>();

        thing.DoNothing();
    }
    public override void JustMockLite()
    {
        JustMock.Reset();
        var thing = JustMock.Create <IThing>();

        thing.OneParameter(0);
    }
Пример #5
0
    public override int JustMockLite()
    {
        JustMock.Reset();
        var thing = JustMock.Create <IThing>();

        JustMock.Arrange(() => thing.One()).Returns(1);
        return(thing.One());
    }
Пример #6
0
    public override void JustMockLite()
    {
        JustMock.Reset();
        var thing = JustMock.Create <IThing>();

        JustMock.Arrange(() => thing.DoSomething());
        thing.DoSomething();
        JustMock.Assert(thing);
    }
Пример #7
0
    public override bool JustMockLite()
    {
        JustMock.Reset();
        var called = false;
        var thing  = JustMock.Create <IThing>();

        JustMock.Arrange(() => thing.DoSomething()).DoInstead(() => called = true);
        thing.DoSomething();
        return(called);
    }
Пример #8
0
        public void CreateMetadata()
        {
            const Behavior mockBehavior = Behavior.Strict;

            var metadataBuilder     = Mock.Create <IMetadataBuilder>(mockBehavior);
            var testObject          = new MetadataRepository(metadataBuilder);
            var environmentMetadata = Mock.Create <IEnvironmentMetadata>(mockBehavior);
            var hierarchyMetadata   = Mock.Create <IHierarchyMetadata>(mockBehavior);
            var graphMetadata       = Mock.Create <IGraphMetadata>(mockBehavior);
            var metadata            = new Model.Metadata(environmentMetadata, hierarchyMetadata, graphMetadata);

            Mock.Arrange(() => metadataBuilder.BuildEnvironmentMetadata()).Returns(environmentMetadata);
            Mock.Arrange(() => metadataBuilder.BuildHierarchyMetadata(environmentMetadata)).Returns(hierarchyMetadata);
            Mock.Arrange(() => metadataBuilder.BuildGraphMetadata(hierarchyMetadata)).Returns(graphMetadata);

            var result = testObject.CreateMetadata();

            Assert.Same(metadata.EnvironmentMetadata, result.EnvironmentMetadata);
            Assert.Same(metadata.HierarchyMetadata, result.HierarchyMetadata);
            Assert.Same(metadata.GraphMetadata, result.GraphMetadata);
        }
Пример #9
0
 public override IThing JustMockLite()
 {
     JustMock.Reset();
     return(JustMock.Create <IThing>());
 }