PageRenderTime 47ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/MongoDB.Bson.Tests/ObjectModel/BsonBooleanTests.cs

http://github.com/mongodb/mongo-csharp-driver
C# | 52 lines | 33 code | 5 blank | 14 comment | 0 complexity | 59d66eb1e477fdc787704c5cc16ddeff MD5 | raw file
Possible License(s): Apache-2.0
  1. /* Copyright 2015-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Threading.Tasks;
  20. using FluentAssertions;
  21. using MongoDB.Bson.TestHelpers.XunitExtensions;
  22. using Xunit;
  23. namespace MongoDB.Bson.Tests.ObjectModel
  24. {
  25. public class BsonBooleanTests
  26. {
  27. [Theory]
  28. [ParameterAttributeData]
  29. public void implicit_conversion_from_bool_should_return_precreated_instance(
  30. [Values(false, true)]
  31. bool value)
  32. {
  33. var result1 = (BsonBoolean)value;
  34. var result2 = (BsonBoolean)value;
  35. result2.Should().BeSameAs(result1);
  36. }
  37. [Theory]
  38. [ParameterAttributeData]
  39. public void precreated_instances_should_have_the_expected_value(
  40. [Values(false, true)]
  41. bool value)
  42. {
  43. var result = (BsonBoolean)value;
  44. result.Value.Should().Be(value);
  45. }
  46. }
  47. }