本文整理汇总了C#中Builder类的典型用法代码示例。如果您正苦于以下问题:C# Builder类的具体用法?C# Builder怎么用?C# Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Builder类属于命名空间,在下文中一共展示了Builder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayGamesClientConfiguration
private PlayGamesClientConfiguration(Builder builder)
{
this.mEnableSavedGames = builder.HasEnableSaveGames();
this.mEnableDeprecatedCloudSave = builder.HasEnableDeprecatedCloudSave();
this.mInvitationDelegate = builder.GetInvitationDelegate();
this.mMatchDelegate = builder.GetMatchDelegate();
}
示例2: ExtendedThreadPool
private ExtendedThreadPool(Builder builder)
{
Name = builder.Name;
SetThreadingRange(builder);
MultiThreadingCapacity = builder.MultiThreadingCapacity;
_taskQueueController = builder.TaskQueueController;
}
示例3: PlayGamesClientConfiguration
/// <summary>
/// Initializes a new instance of the <see cref="GooglePlayGames.BasicApi.PlayGamesClientConfiguration"/> struct.
/// </summary>
/// <param name="builder">Builder for this configuration.</param>
private PlayGamesClientConfiguration(Builder builder)
{
this.mEnableSavedGames = builder.HasEnableSaveGames();
this.mInvitationDelegate = builder.GetInvitationDelegate();
this.mMatchDelegate = builder.GetMatchDelegate();
this.mPermissionRationale = builder.GetPermissionRationale();
}
示例4: m3
public static void m3()
{
SqlConnectionStringBuilder sqlConnectionStringBuilder = new SqlConnectionStringBuilder();
sqlConnectionStringBuilder.DataSource = @"RoXaSDTD-PC\SQLEXPRESS";
sqlConnectionStringBuilder.InitialCatalog = "PlaylistManager";
sqlConnectionStringBuilder.UserID = "Rafael";
sqlConnectionStringBuilder.Password = "rafael";
sqlConnectionStringBuilder.IntegratedSecurity = true;
string connectionString = sqlConnectionStringBuilder.ConnectionString;
Builder builder = new Builder(
typeof(SqlDataMapper<>),
new Object[] { connectionString },
typeof(PropertyColumnMapper),
typeof(MultipleConnectionPolicy));
IDataMapper<Playlist> playlistMapper = builder.Build<Playlist>();
IConnectionPolicy policy = playlistMapper.GetConnectionPolicy();
Playlist p = playlistMapper.GetAll().First();
p.name = "teste";
playlistMapper.Update(p);
Playlist p2 = playlistMapper.GetAll().First();
p2.name = "JoanaPlaylist";
playlistMapper.Update(p2);
}
示例5: ProcessRequest
public void ProcessRequest(IDictionary<string, object> environment,
ResponseCallBack responseCallBack, Action<Exception> errorCallback)
{
Dictionary<string, dynamic> nrackEnvironment = GetNrackEnvironment(environment);
var config = ConfigResolver.GetRackConfigInstance();
var builder = new Builder(config.ExecuteStart);
var response = new OwinResponseAdapter(builder.Call(nrackEnvironment));
responseCallBack(response.Status, response.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToString()),
(next, error, complete) =>
{
try
{
next(response.GetBody(), null);
complete();
}
catch (Exception ex)
{
error(ex);
}
return () => { };
});
}
示例6: ConnectionRejectingTimeoutTest
public void ConnectionRejectingTimeoutTest()
{
var originalTraceLevel = Diagnostics.CassandraTraceSwitch.Level;
Diagnostics.CassandraTraceSwitch.Level = TraceLevel.Verbose;
var sw = Stopwatch.StartNew();
var thrown = false;
try
{
var builder = new Builder().WithDefaultKeyspace("system")
.AddContactPoints("127.9.9.9") // local IP that will most likely not be in use
.WithQueryTimeout(500);
builder.SocketOptions.SetConnectTimeoutMillis(500);
var cluster = builder.Build();
cluster.Connect();
}
catch (NoHostAvailableException)
{
thrown = true;
}
sw.Stop();
Assert.True(thrown, "Expected exception");
Assert.True(sw.Elapsed.TotalMilliseconds < 1000, "The connection timeout was not respected");
Diagnostics.CassandraTraceSwitch.Level = originalTraceLevel;
}
示例7: WebSiteEnvironmnents
Dictionary<string, IEnumerable<WebSiteConfig>> WebSiteEnvironmnents()
{
var webSite = new Builder<WebSiteConfig>(() => new WebSiteConfig {
AppPoolName = "MyWebSite",
Port = 80,
HostName = "mywebsite.com",
Directory = @"C:\Sites\MyWebSite",
});
var envs = new Dictionary<string,IEnumerable<WebSiteConfig>>();
var live = webSite;
envs["live"] = live.OnMachines("live1", "live2");
var stage = webSite.WithHostName("mywebsitestage.com");
envs["stage"] = stage.OnMachines("stage1", "stage2");
var test = webSite.WithHostName("mywebsitetest");
envs["test"] = test.OnMachines("test1");
var dev = webSite.WithNoHostName().WithPort(6001);
envs["dev"] = dev.OnMachines("localhost");
return envs;
}
示例8: When_class_is_changed_to_interface_changed_attributes_are_reported
public void When_class_is_changed_to_interface_changed_attributes_are_reported()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class("Class").Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Interface("Class").Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddChangedFlag("Interface", false, Severity.Error), Times.Once);
}
示例9: ToByteArray
public override byte[] ToByteArray()
{
Builder<byte> b = new Builder<byte>();
b.Append(PacketID);
b.Append(PlayerID);
return b.ToArray();
}
示例10: GetSecurityService
protected override ISecurityService GetSecurityService()
{
var userBuilder = new Builder<IUser>(Mock.Of<IUser>)
.With(u =>
{
u.Email = SecurityTestData.User.Email;
u.PasswordHash = HashService.Hash64(SecurityTestData.User.CorrectPassword);
u.Active = true;
});
var user = userBuilder.Build();
var inactiveUser = userBuilder
.Build(u =>
{
u.Email = SecurityTestData.User.InactiveEmail;
u.Active = false;
});
return new SecurityService(
new UserDataServiceBuilder()
.WithUser(user)
.WithUser(inactiveUser)
.Build(),
new SessionDataServiceBuilder()
.Build(),
HashService,
new UserRegistrationValidator()
);
}
示例11: UpdateSupplierFromProduct
public void UpdateSupplierFromProduct()
{
// Arrange
Builder builder = new Builder(
SqlDataMapperType,
DataMapperParams,
PropertyColumnMapperType,
MultipleConnectionPolicyType);
IDataMapper productMapper = builder.Build<Product>();
IConnectionPolicy explicitConnectionPolicy = productMapper.GetConnectionPolicy();
String fakeName = "teste";
String trueName = "";
String updatedName = "";
// Act
Product p1 = (Product)productMapper.GetAll().First();
trueName = p1.SupplierID.CompanyName;
p1.SupplierID.CompanyName = fakeName;
productMapper.Update(p1);
Product p2 = (Product)productMapper.GetAll().First();
updatedName = p2.SupplierID.CompanyName;
p2.SupplierID.CompanyName = trueName;
productMapper.Update(p2);
// Assert
Assert.AreEqual(fakeName, updatedName);
}
示例12: ServerLimits
private ServerLimits(Builder builder)
{
if (builder.mailbox_max_count_per_user < 0)
throw new ArgumentException("Invalid domain id", "builder");
MailboxMaxCountPerUser = builder.mailbox_max_count_per_user;
}
示例13: CanCreateInstances
public void CanCreateInstances()
{
string config =
@"<object-builder-config xmlns=""pag-object-builder"">
<build-rules>
<build-rule type=""" + FullNameSimpleObject + @""" mode=""Instance"">
<constructor-params>
<value-param type=""System.Int32"">12</value-param>
</constructor-params>
</build-rule>
</build-rules>
</object-builder-config>";
Builder builder = new Builder(ObjectBuilderXmlConfig.FromXml(config));
Locator locator = CreateLocator();
SimpleObject m1 = builder.BuildUp<SimpleObject>(locator, null, null);
SimpleObject m2 = builder.BuildUp<SimpleObject>(locator, null, null);
Assert.IsNotNull(m1);
Assert.IsNotNull(m2);
Assert.AreEqual(12, m1.IntParam);
Assert.AreEqual(12, m2.IntParam);
Assert.IsTrue(m1 != m2);
}
示例14: CreatingAList
public void CreatingAList()
{
var builderSetup = new BuilderSetup();
var products = new Builder<Product>(builderSetup).CreateListOfSize(10).Build();
// Note: The asserts here are intentionally verbose to show how NBuilder works
// It sets strings to their name plus their 1-based sequence number
Assert.That(products[0].Title, Is.EqualTo("Title1"));
Assert.That(products[1].Title, Is.EqualTo("Title2"));
Assert.That(products[2].Title, Is.EqualTo("Title3"));
Assert.That(products[3].Title, Is.EqualTo("Title4"));
Assert.That(products[4].Title, Is.EqualTo("Title5"));
Assert.That(products[5].Title, Is.EqualTo("Title6"));
Assert.That(products[6].Title, Is.EqualTo("Title7"));
Assert.That(products[7].Title, Is.EqualTo("Title8"));
Assert.That(products[8].Title, Is.EqualTo("Title9"));
Assert.That(products[9].Title, Is.EqualTo("Title10"));
// Ints are set to their 1-based sequence number
Assert.That(products[0].Id, Is.EqualTo(1));
// ... 2, 3, 4, 5, 6, 7, 8 ...
Assert.That(products[9].Id, Is.EqualTo(10));
// Any other numeric types are set to their 1-based sequence number
Assert.That(products[0].PriceBeforeTax, Is.EqualTo(1m));
// ... 2m, 3m, 4m, 5m, 6m, 7m, 8m ...
Assert.That(products[9].PriceBeforeTax, Is.EqualTo(10m));
}
示例15: CreateBuilder
public Builder CreateBuilder()
{
Builder temp = new Builder(new Vector2(50, 50), 3);
this.builders.Add(temp);
this.idleBuilders.Add(temp);
return temp;
}