Пример #1
0
        public void ToBsonValue_should_return_proper_value()
        {
            var wMode     = new WriteConcern.WMode("mode");
            var bsonValue = wMode.ToBsonValue();

            bsonValue.Should().BeOfType <BsonString>();
            bsonValue.AsString.Should().Be("mode");
        }
Пример #2
0
        public void ToString_should_return_expected_result()
        {
            var subject = new WriteConcern.WMode("mode");

            var result = subject.ToString();

            result.Should().Be("mode");
        }
Пример #3
0
        public void ToBsonValue_should_return_expected_result()
        {
            var subject = new WriteConcern.WMode("mode");

            var result = subject.ToBsonValue();

            result.Should().BeOfType <BsonString>();
            result.AsString.Should().Be("mode");
        }
Пример #4
0
        public void Equals_should_return_true_if_all_fields_are_equal()
        {
            var wMode1 = new WriteConcern.WMode("mode");
            var wMode2 = new WriteConcern.WMode("mode");

            wMode1.Equals(wMode2).Should().BeTrue();
            wMode1.Equals((object)wMode2).Should().BeTrue();
            wMode1.GetHashCode().Should().Be(wMode2.GetHashCode());
        }
Пример #5
0
        public void Equals_should_return_false_if_values_are_not_equal(string value1, string value2)
        {
            var wMode1 = new WriteConcern.WMode(value1);
            var wMode2 = new WriteConcern.WMode(value2);

            wMode1.Equals(wMode2).Should().BeFalse();
            wMode1.Equals((object)wMode2).Should().BeFalse();
            wMode1.GetHashCode().Should().NotBe(wMode2.GetHashCode());
        }
Пример #6
0
        public void Equals_should_return_true_when_all_fields_are_equal()
        {
            var subject1 = new WriteConcern.WMode("mode");
            var subject2 = new WriteConcern.WMode("mode");

            var result1   = subject1.Equals(subject2);
            var result2   = subject1.Equals((object)subject2);
            var hashCode1 = subject1.GetHashCode();
            var hashCode2 = subject2.GetHashCode();

            result1.Should().BeTrue();
            result2.Should().BeTrue();
            hashCode1.Should().Be(hashCode2);
        }
Пример #7
0
        public void Equals_should_return_false_when_any_fields_are_not_equal()
        {
            var subject1 = new WriteConcern.WMode("mode1");
            var subject2 = new WriteConcern.WMode("mode2");

            var result1   = subject1.Equals(subject2);
            var result2   = subject1.Equals((object)subject2);
            var hashCode1 = subject1.GetHashCode();
            var hashCode2 = subject2.GetHashCode();

            result1.Should().BeFalse();
            result2.Should().BeFalse();
            hashCode1.Should().NotBe(hashCode2);
        }
Пример #8
0
        public void ToString_should_return_expected_value(object w, int?wTimeoutSeconds, bool?fsync, bool?journal, string expected)
        {
            WriteConcern.WValue parsedW;
            if (w == null)
            {
                parsedW = null;
            }
            else if (w is int)
            {
                parsedW = new WriteConcern.WCount((int)w);
            }
            else
            {
                parsedW = new WriteConcern.WMode((string)w);
            }

            var wTimeout     = wTimeoutSeconds.HasValue ? (TimeSpan?)TimeSpan.FromSeconds(wTimeoutSeconds.Value) : null;
            var writeConcern = new WriteConcern(parsedW, wTimeout, fsync, journal);

            writeConcern.ToString().Should().Be(expected);
        }
Пример #9
0
        public void constructor_should_initialize_instance()
        {
            var result = new WriteConcern.WMode("mode");

            result.Value.Should().Be("mode");
        }
Пример #10
0
        public void ToString_should_return_proper_value()
        {
            var wMode = new WriteConcern.WMode("mode");

            wMode.ToString().Should().Be("mode");
        }
Пример #11
0
        public void Constructor_should_initialize_instance()
        {
            var mode = new WriteConcern.WMode("mode");

            mode.Value.Should().Be("mode");
        }