public void Can_update_an_existing_extension() { var optionsBuilder = new EntityOptionsBuilder(); var extension1 = new FakeEntityOptionsExtension1 { Something = "One " }; var extension2 = new FakeEntityOptionsExtension1 { Something = "Two " }; ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension1); ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension2); Assert.Equal(1, optionsBuilder.Options.Extensions.Count()); Assert.DoesNotContain(extension1, optionsBuilder.Options.Extensions); Assert.Contains(extension2, optionsBuilder.Options.Extensions); Assert.Same(extension2, optionsBuilder.Options.FindExtension<FakeEntityOptionsExtension1>()); }
public void Can_update_an_existing_extension() { var optionsBuilder = new EntityOptionsBuilder(); var extension1 = new FakeEntityOptionsExtension1 { Something = "One " }; var extension2 = new FakeEntityOptionsExtension1 { Something = "Two " }; ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension1); ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension2); Assert.Equal(1, optionsBuilder.Options.Extensions.Count()); Assert.DoesNotContain(extension1, optionsBuilder.Options.Extensions); Assert.Contains(extension2, optionsBuilder.Options.Extensions); Assert.Same(extension2, optionsBuilder.Options.FindExtension <FakeEntityOptionsExtension1>()); }
public void Extensions_can_be_added_to_options() { var optionsBuilder = new EntityOptionsBuilder(); Assert.Null(optionsBuilder.Options.FindExtension<FakeEntityOptionsExtension1>()); Assert.Empty(optionsBuilder.Options.Extensions); var extension1 = new FakeEntityOptionsExtension1(); var extension2 = new FakeEntityOptionsExtension2(); ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension1); ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension2); Assert.Equal(2, optionsBuilder.Options.Extensions.Count()); Assert.Contains(extension1, optionsBuilder.Options.Extensions); Assert.Contains(extension2, optionsBuilder.Options.Extensions); Assert.Same(extension1, optionsBuilder.Options.FindExtension<FakeEntityOptionsExtension1>()); Assert.Same(extension2, optionsBuilder.Options.FindExtension<FakeEntityOptionsExtension2>()); }
public void Extensions_can_be_added_to_options() { var optionsBuilder = new EntityOptionsBuilder(); Assert.Null(optionsBuilder.Options.FindExtension <FakeEntityOptionsExtension1>()); Assert.Empty(optionsBuilder.Options.Extensions); var extension1 = new FakeEntityOptionsExtension1(); var extension2 = new FakeEntityOptionsExtension2(); ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension1); ((IOptionsBuilderExtender)optionsBuilder).AddOrUpdateExtension(extension2); Assert.Equal(2, optionsBuilder.Options.Extensions.Count()); Assert.Contains(extension1, optionsBuilder.Options.Extensions); Assert.Contains(extension2, optionsBuilder.Options.Extensions); Assert.Same(extension1, optionsBuilder.Options.FindExtension <FakeEntityOptionsExtension1>()); Assert.Same(extension2, optionsBuilder.Options.FindExtension <FakeEntityOptionsExtension2>()); }