public void SetGet() { // Given var account = new HarvestAccount(); // When account.Password = "******"; // Then account.Password.Should().Be("password test"); }
public void SetGet() { // Given var account = new HarvestAccount(); // When account.UserName = "******"; // Then account.UserName.Should().Be("UserName test"); }
public void SetGet() { // Given var account = new HarvestAccount(); // When account.Uri = "Uri test"; // Then account.Uri.Should().Be("Uri test"); }
public void Constructor_ShouldThrowValidationExceptionWhenAccountIsNotValid() { // Given var account = new HarvestAccount(); // When Action action = () => Activator.CreateInstance(typeof(T), new object[] { account }); // Then action.ShouldThrow <TargetInvocationException>() .WithInnerException <ValidationException>() .Subject.Message.EndsWith("Parameter name: account"); }
public void ChangesAllPublicPropertiesToFrozen() { // Given var account = new HarvestAccount(); // When account.Freeze(); // Then IsFrozen(account, account.Property(x => x.Password), "fake password").Should().BeTrue(); IsFrozen(account, account.Property(x => x.Uri), "http://fakeuri.com").Should().BeTrue(); IsFrozen(account, account.Property(x => x.UserName), "fake user name").Should().BeTrue(); }
public void Constructor_ShouldFreezeAccount() { // Given var account = new HarvestAccount() { Password = "******", Uri = "http://fake.com", UserName = "******" }; // When var harvest = Activator.CreateInstance(typeof(T), new object[] { account }); // Then ((bool)account.GetType().GetField("isFrozen", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(account)).Should().BeTrue(); }
public void Account_GetSet() { // Given var harvest = (T)Activator.CreateInstance(typeof(T), new object[] { new HarvestAccount() { Password = "******", Uri = "http://fake.com", UserName = "******" } }); var account = new HarvestAccount() { Password = "******", Uri = "http://fake.com", UserName = "******" }; // When harvest.Account = account; // Then harvest.Account.Should().BeSameAs(account); }
public void Account_SetShouldFreezeValue() { // Given var accountForConstructor = new HarvestAccount() { Password = "******", Uri = "http://fake.com", UserName = "******" }; var accountForProperty = new HarvestAccount() { Password = "******", Uri = "http://fake.com", UserName = "******" }; var harvest = (T)Activator.CreateInstance(typeof(T), new object[] { accountForConstructor }); // When harvest.Account = accountForProperty; // Then ((bool)accountForProperty.GetType().GetField("isFrozen", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(accountForProperty)).Should().BeTrue(); }
public BaseHarvestApi(HarvestAccount account) { this.Account = account; }