Ejemplo n.º 1
0
        public async Task should_emit_ServiceRefreshed_event_even_with_no_endpoints()
        {
            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Active    = true,
                Name      = "lorem",
                Endpoints = new Mongo.Infrastructure.Entities.ServiceEndpoint[] { }
            };

            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var mockMediator = new Mock <IMediator>();

            var mockPinger = new Mock <IPinger>();

            var validator = new NullValidator <RefreshServiceStatus>();

            var command = new RefreshServiceStatus(service.Id, 10);
            var sut     = new RefreshServiceStatusHandler(mockDbContext.Object, mockPinger.Object, mockMediator.Object, validator);
            await sut.Handle(command);

            mockMediator.Verify(m => m.Publish(It.Is <Core.Events.ServiceRefreshed>(e => e.ServiceId == service.Id),
                                               It.IsAny <System.Threading.CancellationToken>()),
                                Times.Once);
        }
        protected UpdateEntityCommand(Guid id, TEntity entity)
        {
            NullValidator.ValidateParams(id, entity);

            Id     = id;
            Entity = entity;
        }
Ejemplo n.º 3
0
        public async Task should_deactivate_service_when_no_endpoints_available()
        {
            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Active    = true,
                Name      = "lorem",
                Endpoints = Enumerable.Empty <Mongo.Infrastructure.Entities.ServiceEndpoint>()
            };
            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var mockPinger   = new Mock <IPinger>();
            var mockMediator = new Mock <IMediator>();
            var validator    = new NullValidator <RefreshServiceStatus>();

            var sut = new RefreshServiceStatusHandler(mockDbContext.Object, mockPinger.Object, mockMediator.Object, validator);
            await sut.Handle(new RefreshServiceStatus(service.Id, 10));

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.Is <Mongo.Infrastructure.Entities.Service>(r => r.Active == false)),
                            Times.Once());
        }
        public virtual bool Equals(T other)
        {
            NullValidator.Validate(other);

            var t         = GetType();
            var otherType = other.GetType();

            if (t != otherType)
            {
                return(false);
            }

            var fields = t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

            foreach (var field in fields)
            {
                var value1 = field.GetValue(other);
                var value2 = field.GetValue(this);

                if (value1 == null)
                {
                    if (value2 != null)
                    {
                        return(false);
                    }
                }
                else if (!value1.Equals(value2))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 5
0
        public async Task should_update_service_when_found_with_no_endpoints()
        {
            var command = new AddEndpoint(Guid.NewGuid(), Guid.NewGuid(), "ipsum", "dolor");

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = command.ServiceId,
                Name      = "lorem",
                Active    = false,
                Endpoints = null
            };

            var mockRepo = RepositoryUtils.MockRepository(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <AddEndpoint>();

            var sut = new AddEndpointHandler(mockDbContext.Object, validator);
            await sut.Handle(command);

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.Is <Mongo.Infrastructure.Entities.Service>(r =>
                                                                                                r.Id == command.ServiceId &&
                                                                                                r.Active == false &&
                                                                                                null != r.Endpoints && 1 == r.Endpoints.Count() &&
                                                                                                r.Endpoints.Any(es => es.Active == false &&
                                                                                                                es.Id == command.EndpointId &&
                                                                                                                es.Address == command.Address &&
                                                                                                                es.Protocol == command.Protocol))
                                                  ), Times.Once());
        }
Ejemplo n.º 6
0
        public async Task should_delete_service_when_input_valid()
        {
            var startTicks = DateTime.UtcNow.Ticks;

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Active    = true,
                Name      = "lorem",
                Endpoints = Enumerable.Empty <Mongo.Infrastructure.Entities.ServiceEndpoint>()
            };
            var mockServicesRepo = RepositoryUtils.MockRepository(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockServicesRepo.Object);

            var validator = new NullValidator <DeleteService>();

            var sut = new DeleteServiceHandler(mockDbContext.Object, validator);

            await sut.Handle(new DeleteService(service.Id));

            mockServicesRepo.Verify(m => m.DeleteOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >()), Times.Once());
        }
Ejemplo n.º 7
0
        public void Has_default_negated_message()
        {
            var validator = new NullValidator<Person, string>();

            var message = validator.DefaultNegatedErrorMessage;
            Console.WriteLine(message);
            Assert.That(message, Is.Not.Null & Is.Not.Empty);
        }
Ejemplo n.º 8
0
        public async Task <List <T> > SearchEntities(Expression <Func <T, bool> > baseQuery)
        {
            NullValidator.Validate(baseQuery);

            return(await EntityContext()
                   .Where(baseQuery)
                   .ToListAsync());
        }
Ejemplo n.º 9
0
        public void Has_default_negated_message()
        {
            var validator = new NullValidator <Person, string>();

            var message = validator.DefaultNegatedErrorMessage;

            Console.WriteLine(message);
            Assert.That(message, Is.Not.Null & Is.Not.Empty);
        }
Ejemplo n.º 10
0
        public async Task should_activate_service_when_at_least_one_endpoint_responds_to_ping()
        {
            var endpoint1 = new Mongo.Infrastructure.Entities.ServiceEndpoint()
            {
                Address  = "localhost1",
                Protocol = "dolor",
                Active   = true
            };
            var endpoint2 = new Mongo.Infrastructure.Entities.ServiceEndpoint()
            {
                Address  = "localhost2",
                Protocol = "dolor",
                Active   = true
            };

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Active    = false,
                Name      = "lorem",
                Endpoints = new[] {
                    endpoint1, endpoint2
                }
            };
            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var mockPinger = new Mock <IPinger>();

            mockPinger.Setup(p => p.PingAsync(It.IsAny <string>(), It.IsAny <int>()))
            .ReturnsAsync((string Address, int timeout) =>
            {
                return(new PingResult((Address == endpoint2.Address), 0));
            });

            var mockMediator = new Mock <IMediator>();

            var validator = new NullValidator <RefreshServiceStatus>();

            var command = new RefreshServiceStatus(service.Id, 10);
            var sut     = new RefreshServiceStatusHandler(mockDbContext.Object, mockPinger.Object, mockMediator.Object, validator);
            await sut.Handle(command);

            foreach (var endpoint in service.Endpoints)
            {
                mockPinger.Verify(m => m.PingAsync(endpoint.Address, command.Timeout), Times.Once());
            }

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.Is <Mongo.Infrastructure.Entities.Service>(r => r.Active == true && 1 == r.Endpoints.Count(es => es.Active && es.Address == endpoint2.Address))),
                            Times.Once());
        }
Ejemplo n.º 11
0
        public override bool Equals(object obj)
        {
            NullValidator.Validate(obj);

            if (obj is T valueObject)
            {
                return(Equals(valueObject));
            }

            return(false);
        }
Ejemplo n.º 12
0
        private static DefaultRequestHandler Sut(Action <DefaultRequestHandler.Options> configure, bool failRequest = false, bool failResponse = false)
        {
            var options = new DefaultRequestHandler.Options();

            configure(options);

            var validator     = new NullValidator(failRequest, failResponse);
            var dataProvider  = new FakeMockDataProvider();
            var clientFactory = new FakeHttpClientFactory();

            return(new DefaultRequestHandler(options, validator, validator, dataProvider, clientFactory));
        }
Ejemplo n.º 13
0
        public async Task should_throw_when_service_not_found()
        {
            var command = new RemoveEndpoint(Guid.NewGuid(), Guid.NewGuid());

            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>();

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <RemoveEndpoint>();

            var sut = new RemoveEndpointHandler(mockDbContext.Object, validator);
            await Assert.ThrowsAsync <NullReferenceException>(() => sut.Handle(command));
        }
Ejemplo n.º 14
0
        public async Task should_ping_all_endpoints_even_with_exceptions()
        {
            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Active    = true,
                Name      = "lorem",
                Endpoints = new[] {
                    new Mongo.Infrastructure.Entities.ServiceEndpoint()
                    {
                        Active  = true,
                        Address = "localhost"
                    },
                    new Mongo.Infrastructure.Entities.ServiceEndpoint()
                    {
                        Active  = true,
                        Address = "localhost1"
                    }
                }
            };
            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var mockMediator = new Mock <IMediator>();

            var mockPinger = new Mock <IPinger>();

            mockPinger.Setup(p => p.PingAsync(It.IsAny <string>(), It.IsAny <int>()))
            .ReturnsAsync((string Address, int timeout) =>
            {
                if (Address == service.Endpoints.ElementAt(0).Address)
                {
                    throw new Exception(Address);
                }
                return(new PingResult(true, 0));
            });

            var validator = new NullValidator <RefreshServiceStatus>();

            var command = new RefreshServiceStatus(service.Id, 10);
            var sut     = new RefreshServiceStatusHandler(mockDbContext.Object, mockPinger.Object, mockMediator.Object, validator);
            await sut.Handle(command);

            mockPinger.Verify(m => m.PingAsync(It.IsAny <string>(), command.Timeout), Times.Exactly(service.Endpoints.Count()));
        }
Ejemplo n.º 15
0
        public async Task should_not_remove_endpoints_if_none_found()
        {
            var endpoint1 = new Mongo.Infrastructure.Entities.ServiceEndpoint()
            {
                Id       = Guid.NewGuid(),
                Active   = false,
                Address  = "dolor",
                Protocol = "ipsum"
            };
            var endpoint2 = new Mongo.Infrastructure.Entities.ServiceEndpoint()
            {
                Id       = Guid.NewGuid(),
                Active   = false,
                Address  = "dolor",
                Protocol = "amet"
            };
            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Name      = "lorem",
                Active    = false,
                Endpoints = new[]
                {
                    endpoint1, endpoint2
                }
            };

            var mockRepo = RepositoryUtils.MockRepository(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <RemoveEndpoint>();

            var sut = new RemoveEndpointHandler(mockDbContext.Object, validator);

            var command = new RemoveEndpoint(service.Id, Guid.NewGuid());
            await sut.Handle(command);

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.Is <Mongo.Infrastructure.Entities.Service>(r =>
                                                                                                r.Id == service.Id &&
                                                                                                null != r.Endpoints && 2 == r.Endpoints.Count())
                                                  ), Times.Once());
        }
Ejemplo n.º 16
0
        public async Task should_deactivate_service_when_no_endpoints_responds_to_ping()
        {
            var endpoint = new Mongo.Infrastructure.Entities.ServiceEndpoint()
            {
                Address  = "localhost",
                Protocol = "dolor",
                Active   = true
            };

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Active    = true,
                Name      = "lorem",
                Endpoints = new[] {
                    endpoint
                }
            };
            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var mockPinger = new Mock <IPinger>();

            mockPinger.Setup(p => p.PingAsync(It.IsAny <string>(), It.IsAny <int>()))
            .ReturnsAsync(new PingResult(false, 0));

            var mockMediator = new Mock <IMediator>();

            var validator = new NullValidator <RefreshServiceStatus>();

            var command = new RefreshServiceStatus(service.Id, 10);
            var sut     = new RefreshServiceStatusHandler(mockDbContext.Object, mockPinger.Object, mockMediator.Object, validator);
            await sut.Handle(command);

            mockPinger.Verify(m => m.PingAsync(service.Endpoints.ElementAt(0).Address, command.Timeout), Times.Once());

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.Is <Mongo.Infrastructure.Entities.Service>(r => r.Active == false && !r.Endpoints.Any(es => es.Active))),
                            Times.Once());
        }
Ejemplo n.º 17
0
        public async Task should_update_endpoint_roundtrip_time()
        {
            var endpoint = new Mongo.Infrastructure.Entities.ServiceEndpoint()
            {
                Address       = "localhost1",
                Protocol      = "dolor",
                Active        = false,
                RoundtripTime = long.MaxValue
            };

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Active    = false,
                Name      = "lorem",
                Endpoints = new[] {
                    endpoint
                }
            };
            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var mockPinger = new Mock <IPinger>();

            mockPinger.Setup(p => p.PingAsync(It.IsAny <string>(), It.IsAny <int>()))
            .ReturnsAsync(new PingResult(true, 42));

            var mockMediator = new Mock <IMediator>();

            var validator = new NullValidator <RefreshServiceStatus>();

            var command = new RefreshServiceStatus(service.Id, 10);
            var sut     = new RefreshServiceStatusHandler(mockDbContext.Object, mockPinger.Object, mockMediator.Object, validator);
            await sut.Handle(command);

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.Is <Mongo.Infrastructure.Entities.Service>(r => r.Endpoints.Any(es => es.RoundtripTime == 42))),
                            Times.Once());
        }
Ejemplo n.º 18
0
        public async Task should_throw_when_endpoint_not_found()
        {
            var command = new UpdateEndpoint(Guid.NewGuid(), Guid.NewGuid(), "lorem", "ipsum");

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = command.ServiceId,
                Active    = false,
                Endpoints = Enumerable.Empty <Mongo.Infrastructure.Entities.ServiceEndpoint>()
            };

            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>();

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <UpdateEndpoint>();

            var sut = new UpdateEndpointHandler(mockDbContext.Object, validator);
            await Assert.ThrowsAsync <NullReferenceException>(() => sut.Handle(command));
        }
Ejemplo n.º 19
0
        public async Task should_throw_when_service_has_null_endpoints()
        {
            var command = new RemoveEndpoint(Guid.NewGuid(), Guid.NewGuid());

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = command.ServiceId,
                Active    = false,
                Endpoints = null
            };

            var mockRepo = RepositoryUtils.MockRepository(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <RemoveEndpoint>();

            var sut = new RemoveEndpointHandler(mockDbContext.Object, validator);
            await Assert.ThrowsAsync <ArgumentNullException>(() => sut.Handle(command));
        }
Ejemplo n.º 20
0
        public async Task should_insert_service()
        {
            var command = new CreateService(Guid.NewGuid(), "lorem");

            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>();

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <CreateService>();

            var sut = new CreateServiceHandler(mockDbContext.Object, validator);
            await sut.Handle(command);

            mockRepo.Verify(m => m.InsertOneAsync(It.Is <Mongo.Infrastructure.Entities.Service>(r =>
                                                                                                r.Id == command.ServiceId &&
                                                                                                r.Name == command.ServiceName &&
                                                                                                r.Active == false &&
                                                                                                null != r.Endpoints && 0 == r.Endpoints.Count())
                                                  ), Times.Once());
        }
Ejemplo n.º 21
0
        public async Task should_not_replace_endpoint_when_found_by_id()
        {
            var endpoint = new Mongo.Infrastructure.Entities.ServiceEndpoint()
            {
                Id       = Guid.NewGuid(),
                Active   = false,
                Address  = "localhost",
                Protocol = "http"
            };

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Name      = "lorem",
                Active    = false,
                Endpoints = new[]
                {
                    endpoint
                }
            };

            var command = new AddEndpoint(service.Id, endpoint.Id, "ipsum", "dolor");

            var mockRepo = RepositoryUtils.MockRepository(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <AddEndpoint>();

            var sut = new AddEndpointHandler(mockDbContext.Object, validator);
            await sut.Handle(command);

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.IsAny <Mongo.Infrastructure.Entities.Service>()), Times.Never());
        }
Ejemplo n.º 22
0
        public async Task should_remove_endpoint()
        {
            var command = new RemoveEndpoint(Guid.NewGuid(), Guid.NewGuid());

            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = command.ServiceId,
                Active    = false,
                Endpoints = new[]
                {
                    new Mongo.Infrastructure.Entities.ServiceEndpoint()
                    {
                        Id     = command.EndpointId,
                        Active = false,
                    }
                }
            };

            var mockRepo = RepositoryUtils.MockRepository(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var validator = new NullValidator <RemoveEndpoint>();

            var sut = new RemoveEndpointHandler(mockDbContext.Object, validator);
            await sut.Handle(command);

            mockRepo.Verify(m => m.UpsertOneAsync(It.IsAny <Expression <Func <Mongo.Infrastructure.Entities.Service, bool> > >(),
                                                  It.Is <Mongo.Infrastructure.Entities.Service>(r =>
                                                                                                r.Id == command.ServiceId &&
                                                                                                r.Active == false &&
                                                                                                null != r.Endpoints && !r.Endpoints.Any(e => e.Id == command.EndpointId))
                                                  ), Times.Once());
        }
        public async Task should_publish_RefreshServiceStatus_command_for_each_service()
        {
            var services = new[] {
                new Mongo.Infrastructure.Entities.Service()
                {
                    Id        = System.Guid.NewGuid(),
                    Active    = true,
                    Name      = "lorem",
                    Endpoints = Enumerable.Empty <Mongo.Infrastructure.Entities.ServiceEndpoint>()
                },
                new Mongo.Infrastructure.Entities.Service()
                {
                    Id        = System.Guid.NewGuid(),
                    Active    = true,
                    Name      = "ipsum",
                    Endpoints = Enumerable.Empty <Mongo.Infrastructure.Entities.ServiceEndpoint>()
                }
            };
            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>(services);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var mockMediator = new Mock <IMediator>();

            var validator = new NullValidator <RefreshServicesStatus>();

            var sut = new RefreshServicesStatusHandler(mockDbContext.Object, mockMediator.Object, validator);
            await sut.Handle(new RefreshServicesStatus(10));

            foreach (var service in services)
            {
                mockMediator.Verify(m => m.Publish(It.Is <RefreshServiceStatus>(r => r.ServiceId == service.Id), It.IsAny <System.Threading.CancellationToken>()), Times.Once());
            }
        }
Ejemplo n.º 24
0
        protected Entity(Guid id)
        {
            NullValidator.ValidateGuid(id);

            Id = id;
        }
Ejemplo n.º 25
0
        protected GetByIdQuery(Guid id)
        {
            NullValidator.ValidateGuid(id);

            Id = id;
        }
Ejemplo n.º 26
0
        protected DeleteCommand(Guid id)
        {
            NullValidator.ValidateGuid(id);

            Id = id;
        }
Ejemplo n.º 27
0
        public static bool operator ==(ValueObject <T> firstValueObject, ValueObject <T> secondValueObject)
        {
            NullValidator.Validate(firstValueObject);

            return(firstValueObject.Equals(secondValueObject));
        }
Ejemplo n.º 28
0
        protected AllEntitiesResponse(IEnumerable <TEntity> entities)
        {
            NullValidator.Validate(entities);

            Entities = entities;
        }
        protected void AddNotification(INotification notification)
        {
            NullValidator.Validate(notification);

            _notifications.Add(notification);
        }
Ejemplo n.º 30
0
        public void Should_be_invalid_when_value_is_not_null()
        {
            var validator = new NullValidator<Person, string>();

            Assert.That(validator.Validate(null, "valid"), Is.False);
        }
Ejemplo n.º 31
0
        public void Should_be_valid_when_value_is_null()
        {
            var validator = new NullValidator<Person, string>();

            Assert.That(validator.Validate(null, null), Is.True);
        }
Ejemplo n.º 32
0
        public void Should_be_valid_when_value_is_null()
        {
            var validator = new NullValidator <Person, string>();

            Assert.That(validator.Validate(null, null), Is.True);
        }
Ejemplo n.º 33
0
        public void Should_be_invalid_when_value_is_not_null()
        {
            var validator = new NullValidator <Person, string>();

            Assert.That(validator.Validate(null, "valid"), Is.False);
        }