示例#1
0
        public void WhenDeletingAPassword_ItShouldBeDeleted()
        {
            // Given
            IDatastore originalDatastore   = null;
            AccountDto twitterAccount      = null;
            FieldDto   originalPasswordDto = null;
            FieldDto   changedPasswordDto  = FakeData.FakeDataGenerator.GetFacebookPassword();

            // When
            TestWithPrepopulatedDatastore(dataStore =>
            {
                originalDatastore = dataStore;
                twitterAccount    =
                    dataStore.GetAccountDtos().First(account =>
                                                     account.ProviderKey == FakeData.FakeDataGenerator.TwitterProviderKey);
                originalPasswordDto = twitterAccount.Fields.Single(field => field.FieldTypeKey == "pin");
                twitterAccount.Fields.Remove(originalPasswordDto);
                twitterAccount.Fields.Add(changedPasswordDto);
                originalDatastore.SaveAccountDto(twitterAccount);
            });

            // Then
            originalDatastore.GetAccountDto(twitterAccount.Id).Fields.Should().NotContain(originalPasswordDto);
            originalDatastore.GetAccountDto(twitterAccount.Id).Fields.Should().Contain(changedPasswordDto);
        }
示例#2
0
        //private void TestWithBothDatastores(Action<IDatastore> test) {
        //    test(GetDatastoreWithFakeData());
        //    test(GetDatastore());
        //}

        private void TestAccountAndPassword(IDatastore dataStore, AccountDto accountDto)
        {
            dataStore.GetAllAccountIds().Should().Contain(id => id.Equals(accountDto.Id));
            dataStore.GetAccountDtos().Should().Contain(dataStoreAccountDto => accountDto.Id == dataStoreAccountDto.Id);
            dataStore.GetAccountDto(accountDto.Id).Equals(accountDto).Should().BeTrue();
            dataStore.GetAccountDto(accountDto.Id).IsDeleted.Should().Be(accountDto.IsDeleted);
            dataStore.GetAccountDto(accountDto.Id).Id.Should().Be(accountDto.Id);
            dataStore.GetAccountDto(accountDto.Id).LastChangedUtc.Should().Be(accountDto.LastChangedUtc);
            dataStore.GetAccountDto(accountDto.Id).Notes.Should().Be(accountDto.Notes);
            dataStore.GetAccountDto(accountDto.Id).ProviderKey.Should().Be(accountDto.ProviderKey);
            dataStore.GetAccountDto(accountDto.Id).Tags.Should().Equal(accountDto.Tags);
            dataStore.GetAccountDto(accountDto.Id).Fields.Should().Equal(accountDto.Fields);
            //dataStore.GetPasswordDtos(accountDto.Id).Should().HaveCount(passwordDtos.Count());
            //dataStore.GetPasswordDtos(accountDto.Id).First().Equals(passwordDtos.First()).Should().BeTrue();
            //dataStore.GetPasswordDtos(accountDto.Id).Should().Equal(passwordDtos);
        }
示例#3
0
 //private void TestWithBothDatastores(Action<IDatastore> test) {
 //    test(GetDatastoreWithFakeData());
 //    test(GetDatastore());
 //}
 private void TestAccountAndPassword(IDatastore dataStore, AccountDto accountDto)
 {
     dataStore.GetAllAccountIds().Should().Contain(id => id.Equals(accountDto.Id));
     dataStore.GetAccountDtos().Should().Contain(dataStoreAccountDto => accountDto.Id == dataStoreAccountDto.Id);
     dataStore.GetAccountDto(accountDto.Id).Equals(accountDto).Should().BeTrue();
     dataStore.GetAccountDto(accountDto.Id).IsDeleted.Should().Be(accountDto.IsDeleted);
     dataStore.GetAccountDto(accountDto.Id).Id.Should().Be(accountDto.Id);
     dataStore.GetAccountDto(accountDto.Id).LastChangedUtc.Should().Be(accountDto.LastChangedUtc);
     dataStore.GetAccountDto(accountDto.Id).Notes.Should().Be(accountDto.Notes);
     dataStore.GetAccountDto(accountDto.Id).ProviderKey.Should().Be(accountDto.ProviderKey);
     dataStore.GetAccountDto(accountDto.Id).Tags.Should().Equal(accountDto.Tags);
     dataStore.GetAccountDto(accountDto.Id).Fields.Should().Equal(accountDto.Fields);
     //dataStore.GetPasswordDtos(accountDto.Id).Should().HaveCount(passwordDtos.Count());
     //dataStore.GetPasswordDtos(accountDto.Id).First().Equals(passwordDtos.First()).Should().BeTrue();
     //dataStore.GetPasswordDtos(accountDto.Id).Should().Equal(passwordDtos);
 }